fix: Detect and clear stale IndexedDB auth tokens on mobile (#188) #190
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Relates to #188
Summary
Fix stale token detection in TokenInjector so that expired IndexedDB tokens don't cause
isAuthenticatedto be incorrectlytrue, which preventsloginWithRedirect()from being called.Problem
Auth0 SDK reads expired tokens from IndexedDB cache and temporarily evaluates
isAuthenticated = true. When user taps "Login",handleAuthAction()seesisAuthenticated = trueand callsnavigate('/garage')instead ofloginWithRedirect(). Tokens fail validation,isAuthenticatedreverts tofalse, and user bounces back to homepage.Changes
frontend/src/core/auth/Auth0Provider.tsxisAuthenticatedbecomestrue, validate token is usable viagetAccessTokenSilently({ cacheMode: 'off' })login_requiredorconsent_required, clear IndexedDB cache and reset Auth0 SDK statefrontend/src/core/utils/indexeddb-storage.tsclearAll()method to clear all cached auth tokens programmaticallyAcceptance Criteria
isAuthenticatedcorrectly reportsfalse