Skip to content

fix: preserve credentials on timeout and offline refresh errors#362

Open
naveengaur800 wants to merge 2 commits intoForgeRock:developfrom
naveengaur800:fix/token-refresh-timeout-offline-only
Open

fix: preserve credentials on timeout and offline refresh errors#362
naveengaur800 wants to merge 2 commits intoForgeRock:developfrom
naveengaur800:fix/token-refresh-timeout-offline-only

Conversation

@naveengaur800
Copy link

@naveengaur800 naveengaur800 commented Feb 23, 2026

This PR fixes an auth reliability issue where temporary network failures during token renewal could force a full logout.

Problem

When getAccessToken() triggered renewal and the request failed due to transport conditions (no internet or timeout), the flow treated that failure like an unrecoverable auth rejection and cleared local auth state.

That converted a transient outage into a permanent logout, requiring full re-authentication even
though credentials could still be valid.

Context

  • Clearing tokens on transport failure degrades user experience and causes unnecessary re-login.
  • SDK consumers need the original failure reason to handle retry UX correctly.

What changed

For transport-level failures (offline/timeout), token renewal is now non-destructive:

  • local auth state is preserved
  • the original network error is returned to the caller

Behavior for true authentication failures (for example invalid/unauthorized token scenarios) is unchanged.

Impact

Users are no longer logged out because of temporary network problems, and clients can show retry UX based on the actual failure.

@naveengaur800 naveengaur800 force-pushed the fix/token-refresh-timeout-offline-only branch 2 times, most recently from 4e7f447 to 569d41f Compare February 23, 2026 12:45
@naveengaur800 naveengaur800 force-pushed the fix/token-refresh-timeout-offline-only branch from 569d41f to ac24d8d Compare February 23, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant