Skip to content

fix: don't drop the stored session on transient refresh failures - #63

Merged
IvanKiral merged 3 commits into
masterfrom
fix-bugs-20260408
Aug 5, 2026
Merged

fix: don't drop the stored session on transient refresh failures#63
IvanKiral merged 3 commits into
masterfrom
fix-bugs-20260408

Conversation

@IvanKiral

Copy link
Copy Markdown
Contributor

What

Previously any token-refresh failure cleared the stored session, so a network blip forced a full re-login. Refresh failures are now classified per RFC 6749 §5.2:

  • invalid_grant (refresh-rejected) — the refresh token is dead (expired, revoked, rotated). Stored tokens are cleared; kontent login falls back straight to the device flow, getValidAccessToken reports not-logged-in.
  • Anything else (refresh-failed) — transient (network, Auth0 outage). The session is kept so the next run can retry silently, and the error is surfaced.

Also

  • Telemetry: the first run now sends events. The notice is printed before any event fires; if persisting telemetryNoticeShown fails, the mode string says the notice will repeat.
  • Tests: unit coverage for decideAuth, refreshOrClear, getValidAccessToken, and performLogin fallback paths; clearMocks: true in vitest config replaces manual mockClear() calls.

@IvanKiral
IvanKiral requested a review from a team as a code owner August 4, 2026 15:19
@IvanKiral
IvanKiral merged commit 57c0894 into master Aug 5, 2026
1 check passed
@IvanKiral
IvanKiral deleted the fix-bugs-20260408 branch August 5, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants