Skip to content

Fix: Prevent cascading 401 errors by forcing logout on token expiration#246

Draft
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/auth-401-logout
Draft

Fix: Prevent cascading 401 errors by forcing logout on token expiration#246
seer-by-sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/auth-401-logout

Conversation

@seer-by-sentry

@seer-by-sentry seer-by-sentry Bot commented Jan 7, 2026

Copy link
Copy Markdown

This PR addresses an issue where the application would get stuck in a loop of failed API calls (cascading 401 errors) if the stored OAuth token became invalid, expired, or was revoked.

Changes:

  1. API Error Handling: Introduced logic in SentryApiMiddleware to detect HTTP 401 responses (ApiError.isAuthenticationError).
  2. Forced Logout: When a 401 is detected, an AuthenticationRequiredAction is dispatched.
  3. Credential Cleanup: The SecureStorageMiddleware handles this action by clearing the stored authToken and dispatching a LogoutAction.

This ensures that users are gracefully logged out and prompted to re-authenticate immediately upon token invalidation, preventing continuous failed requests.

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.

0 participants