Skip to content

feat: support allow_expired query parameter for JWT validation#2257

Closed
mandarini wants to merge 2 commits intomasterfrom
feat/support-allow-expired-jwt-parameter
Closed

feat: support allow_expired query parameter for JWT validation#2257
mandarini wants to merge 2 commits intomasterfrom
feat/support-allow-expired-jwt-parameter

Conversation

@mandarini
Copy link
Copy Markdown

Description

Adds support for allow_expired=true query parameter to allow decoding expired JWTs for legitimate use cases (debugging, audit logs, displaying user info after expiration).

Fixes: #2256

Changes

  • Modified parseJWTClaims() in internal/api/auth.go to check for allow_expired query parameter
  • When allow_expired=true, JWT parser skips claims validation (including expiration check)
  • Default behavior unchanged: JWTs are validated including expiration by default

Security Considerations

  • The JWT signature is still verified (not bypassed)
  • Only the expiration time check is skipped
  • This should be used only for specific legitimate use cases
  • The client library (supabase-js) will control when this parameter is passed

Testing

Tested with expired JWTs:

  • Without parameter: correctly rejects with expiration error
  • With allow_expired=true: successfully decodes and returns user data
  • Signature validation still enforced in both cases

@mandarini mandarini force-pushed the feat/support-allow-expired-jwt-parameter branch from 77ba7de to 3b35ecc Compare November 13, 2025 08:29
@mandarini mandarini self-assigned this Nov 13, 2025
@cstockton
Copy link
Copy Markdown
Contributor

@mandarini Are you still wanting to implement this? If you are we will need a greater refactor here because parseJWTClaims is shared by areas of code which must respect JWT expiration.

@mandarini mandarini closed this Jan 28, 2026
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.

getClaims allowExpired

2 participants