mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
Oura's current authorization server enforces scopes per collection. daily_spo2 needs spo2; vO2_max, daily_cardiovascular_age and daily_resilience need heart_health. The authorize request now asks for both. A grant issued before keeps answering 401 on those four collections while every other one succeeds. Such a 401 next to a success is now recorded as a scope gap rather than a failure: it no longer counts toward the reconnect threshold, it no longer forces a token refresh once known, and the Oura card asks for one reconnect instead. The Withings card names the readings the account's API plan withholds.
24 lines
769 B
TypeScript
24 lines
769 B
TypeScript
/**
|
|
* Oura collections that sit behind a scope beyond `daily` (`spo2`,
|
|
* `heart_health`). A grant issued before HealthLog requested those scopes
|
|
* answers 401 on exactly these, so they are the only names the settings card
|
|
* can be asked to explain. Each has a label under
|
|
* `settings.integrations.oura.scope.items`.
|
|
*/
|
|
export const OURA_SCOPE_GATED_COLLECTIONS = [
|
|
"spo2",
|
|
"vo2max",
|
|
"cardio_age",
|
|
"resilience",
|
|
] as const;
|
|
|
|
export type OuraScopeGatedCollection =
|
|
(typeof OURA_SCOPE_GATED_COLLECTIONS)[number];
|
|
|
|
/** Narrow a stored list to the known names, in display order. */
|
|
export function ouraScopeReconnectList(
|
|
denied: readonly string[],
|
|
): OuraScopeGatedCollection[] {
|
|
return OURA_SCOPE_GATED_COLLECTIONS.filter((c) => denied.includes(c));
|
|
}
|