SIGN IN SIGN UP

⌛ fix: Use JWT exp claim for MCP when OAuth token omits expires_in (#13248)

MCP OAuth access tokens are stored with a 365-day default expiry when the
provider's token response omits `expires_in` (only RECOMMENDED per RFC 6749
§5.1). Providers that issue short-lived JWT access tokens but omit
`expires_in` (e.g. Salesforce) therefore get tokens treated as valid for a
year and never refreshed, so every call 401s once the real token lapses
until the user manually reconnects.

When the access token is a JWT (RFC 9068), read its `exp` claim and use it as
the authoritative expiry, falling back to the 365-day default only for opaque
tokens. Explicit `expires_at`/`expires_in` still take precedence.

Adds unit tests for storeTokens expiry resolution.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
D
Dev Chohan committed
01af63cb52f4dccdcccf0ea6ea4f7632bc387723
Parent: 03b477a
Committed by GitHub <noreply@github.com> on 5/23/2026, 1:20:59 AM