Repository navigation
Closed
Copy link
Description
What happened?
frontend/src/app/app.module.ts configured JwtModule.forRoot with skipWhenExpired: false, and the app had no global HttpInterceptor that observed 401 responses. Two consequences:
- Whenever localStorage held a JWT, that token was attached as
Authorization: Bearer …to every non-disallowedRoutesrequest — including the anonymous pre-login config fetch — even after itsexpwas in the past. The backend then rejected the stale token, breaking page bootstrap. - Individual services scattered their own
catchErrorcalls but none cleared the session or redirected to the landing page, so a backend-rejected token left the user "logged in" client-side: header still showed the user, but every authenticated request errored out.
The earlier eager-JwtAuthFilter attempt (PR #4903) merged on main and the very next day a user with a stale localStorage token reproduced this — the login page itself returned 401 for GET /api/config/gui and /api/config/user-system, which triggered the revert in PR #5025 (issue #5026).
How to reproduce?
- Reach a state where localStorage contains an
access_tokenwhoseexpclaim is in the past — e.g. open DevTools and runlocalStorage.setItem("access_token", "<old-token-from-a-prior-session>"), or close the tab for longer than the configuredexpiration-in-minutes(7 days as of PR feat(auth): removed token refresh functionality #3765) and re-open. - Visit the app at
/about. - Observe (against the pre-fix(frontend): handle 401 by clearing session, skip sending expired JWTs #5392 commit
8a4cb29e1):- Every request, including the anonymous
/api/config/pre-loginand/api/config/guifetches, carries the staleAuthorizationheader. - Backend (
ambertoastshaman filter, orJwtAuthFilteronce eager-401 is enabled) rejects with 401. - No global handler clears the bad token or redirects, so the user sees a generic error toast and the page stays in a broken state.
- Every request, including the anonymous
Branch
main
Commit Hash (Optional)
8a4cb29 (immediately before PR #5392 landed)
What browsers are you seeing the problem on?
- Chrome / Chromium
Relevant log output
ERROR org.apache.texera.auth.JwtParser$: Failed to parse JWT: JWT (claims->{"sub":"texera","userId":1,"role":"ADMIN","exp":1777324924}) rejected due to invalid claims or other invalid content. Additional details: [[1] The JWT is no longer valid - the evaluation time NumericDate{... May 11, 2026, 12:33:08 PM PDT} is on or after the Expiration Time (exp=NumericDate{... Apr 27, 2026, 2:22:04 PM PDT}) claim value (even when providing 30 seconds of leeway to account for clock skew).]
WARN org.apache.texera.auth.JwtAuthFilter: Invalid JWT: Unable to parse token
INFO org.eclipse.jetty.server.RequestLog: [0:0:0:0:0:0:0:1] - "GET /api/config/user-system HTTP/1.1" 401
INFO org.eclipse.jetty.server.RequestLog: [0:0:0:0:0:0:0:1] - "GET /api/config/gui HTTP/1.1" 401Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(frontend): handle 401 by clearing session, skip sending expired J…
fix(frontend): handle 401 by clearing session, skip sending expired J…
fix(frontend): handle 401 by clearing session, skip sending expired J…