Skip to content

fix(auth): preserve config on transient server/network errors - #253

Open
prathamesh04 wants to merge 1 commit into
metacall:masterfrom
prathamesh04:fix/token-validation-transient-errors
Open

fix(auth): preserve config on transient server/network errors#253
prathamesh04 wants to merge 1 commit into
metacall:masterfrom
prathamesh04:fix/token-validation-transient-errors

Conversation

@prathamesh04

Copy link
Copy Markdown

Description

The validateToken function was deleting the cached config for any exception thrown by api.validate(), including temporary outages, DNS failures, or non-auth server errors. This forced users to re-login even when their credentials were valid.

Fixes #232

Changes

  • Distinguish auth errors (401, 403, JWT-related) from transient errors
  • Preserve cached config for network failures and server errors
  • Show warning message for transient errors instead of error
  • Extract invalidateConfig helper function
  • Add isJwtError helper to detect JWT-specific errors

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Build passes (npm run build)
  • Lint passes (npm run lint)

The validateToken function was deleting the cached config for any
exception thrown by api.validate(), including temporary outages,
DNS failures, or non-auth server errors. This forced users to
re-login even when their credentials were valid.

Changes:
- Distinguish auth errors (401, 430, JWT-related) from transient errors
- Preserve cached config for network failures and server errors
- Show warning message for transient errors instead of error
- Extract invalidateConfig helper function
- Add isJwtError helper to detect JWT-specific errors

Fixes metacall#232
@prathamesh04

Copy link
Copy Markdown
Author

cc @viferga @josead

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.

Bug: token validation deletes cached config on transient server or network failures

1 participant