mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
Connect an Oura account over the Cloud v2 API: an authorization-code OAuth flow (shared app from OURA_CLIENT_ID / OURA_CLIENT_SECRET) on the same signed state machinery as Polar. Unlike Polar, Oura issues refresh tokens; the sync refreshes reactively on a 401, rotating and re-encrypting both tokens, and a 403 stays a hard reauth rather than a refresh. An hourly poll-cohort job maps daily readiness to RECOVERY_SCORE, sleep to per-stage durations plus efficiency / HRV / resting heart rate / respiratory rate, and daily activity to steps and active energy — all tagged source OURA, idempotent on (userId, type, source, externalId). Readiness flows through the canonical recovery ladder above the computed proxy. Settings gains a connect / disconnect card. Tokens are never logged or returned; every egress goes through safeFetch.