mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
fix(oura): name the issuer refusal on the integrations page
This commit is contained in:
1 parent
5d7e0248b6
commit
9a86a9427b
9 files changed
+53
-1
No files matched your search
@@ -127,6 +127,17 @@ const OAUTH_OUTCOME_REASONS = new Set([
|
||||
"expired",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Reason tags only one provider's callback emits, with copy under that
|
||||
* provider's subtree alone. Oura's `issuer`: the authorization response named
|
||||
* an issuer that is not Oura's (RFC 9207), so the callback refused the code.
|
||||
*/
|
||||
const PROVIDER_ONLY_REASONS: Partial<
|
||||
Record<OAuthOutcomeProvider, ReadonlySet<string>>
|
||||
> = {
|
||||
oura: new Set(["issuer"]),
|
||||
};
|
||||
|
||||
type OAuthOutcome =
|
||||
| { provider: OAuthOutcomeProvider; kind: "connected" }
|
||||
| { provider: OAuthOutcomeProvider; kind: "error"; reason: string };
|
||||
@@ -162,7 +173,8 @@ export function oauthReasonKey(
|
||||
reason: string,
|
||||
): string {
|
||||
const base = OAUTH_ERROR_KEY_BASE[provider];
|
||||
return OAUTH_OUTCOME_REASONS.has(reason)
|
||||
return OAUTH_OUTCOME_REASONS.has(reason) ||
|
||||
PROVIDER_ONLY_REASONS[provider]?.has(reason)
|
||||
? `${base}.${reason}`
|
||||
: `${base}.generic`;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user