fix: Mobile login redirects to homepage without showing Auth0 login page (#188) #193
Reference in New Issue
Block a user
Delete Branch "issue-188-fix-mobile-login-redirect"
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?
Fixes #188
Fixes #189
Fixes #190
Fixes #192
Summary
Mobile login was broken: tapping "Login" caused a flash-redirect back to the homepage without ever showing the Auth0 login page. Two root causes identified and fixed:
Callback route guard too strict (M1):
App.tsxrequiredisCallbackRoute && isAuthenticatedto render CallbackPage. During Auth0 code exchange on mobile,isAuthenticatedis brieflyfalse, causing/callbackto fall through to the!isAuthenticatedredirect. Fixed by showing a loading state on/callbackwhile Auth0 processes.Stale token misdirection (M2): Auth0 SDK reads expired tokens from IndexedDB cache and temporarily evaluates
isAuthenticated = true. The homepage then navigates to/garageinstead of callingloginWithRedirect(). Fixed by validating tokens whenisAuthenticatedbecomestrueand clearing stale state when validation fails.No self-recovery mechanism (M3): Users stuck in auth limbo had no way to clear credentials (logout is in Settings, which requires auth). Added "Trouble logging in?" link on the homepage that clears IndexedDB auth cache, localStorage auth items, and Auth0 SDK state.
Files Changed
frontend/src/App.tsxfrontend/src/core/auth/Auth0Provider.tsxvalidatingRefguard in TokenInjectorfrontend/src/core/utils/indexeddb-storage.tsclearAll()method with abort/error handlersfrontend/src/pages/HomePage.tsxQuality Checks
Test Plan