Fix silent auth redirect with expired client credentials#4181
Fix silent auth redirect with expired client credentials#4181timgent wants to merge 1 commit intoinrupt:mainfrom
Conversation
d02584a to
ecac935
Compare
|
Thanks for opening this PR! I'll have a look as soon as possible :) |
b3b7d29 to
091227c
Compare
packages/browser/src/Session.ts
Outdated
There was a problem hiding this comment.
Can this check be moved up to validateCurrentSession?
There was a problem hiding this comment.
Yep fair point, will update when I find a few mins 👍
ebaee2b to
0930fdd
Compare
|
I'm sorry, I didn't realize until now your commits weren't signed. We have a branch protection rule requiring signed commit. I can sign the commit myself, but for proper attribution I'd prefer that you setup signing keys if it's okay with you. Github provides some intructions on how to do this. If it's too much of a bother, I can go ahead with my own signature, but I would prefer you get full credit for your work :) |
0930fdd to
92b76c6
Compare
|
@NSeydoux sorry for missing that - I've updated the commit so it's now signed. Thanks again for engaging so quickly with the issue and for reviewing this PR! |
When client credentials expire, the silent authentication flow now correctly detects the expiration and gracefully falls back to a logged-out state instead of redirecting to the OAuth provider and showing an error page. Adds a clientExpiresAt field to ISessionInternalInfo, reads it from storage in SessionInfoManager, and updates the CHANGELOG. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
92b76c6 to
c0207d2
Compare
This PR fixes bug #4177.
Summary
When
handleIncomingRedirect({ restorePreviousSession: true })is called with stored session data containing an expiredclient_id, the library now validates client expiration before attempting silent authentication. This prevents the redirect to the OAuth provider with invalid credentials, which previously caused users to be stuck on an error page.Changes
clientExpiresAtfield toISessionInternalInfoso client expiration data flows through the existingSessionInfoManager.get()→validateCurrentSession()→silentlyAuthenticate()pathexpiresAtfrom storage in the browserSessionInfoManager.get()and return it asclientExpiresAtsilentlyAuthenticate()using the session info fields, rather than a separate methodDesign
Rather than adding a separate
isClientExpired()method and threadingstorageUtilitythrough theClientAuthenticationconstructor, the expiration timestamp is surfaced as part of the session info that already gets retrieved during silent auth. This keeps the change minimal and avoids extra constructor parameters, mock plumbing, and redundant storage reads.Checklist
🤖 Generated with Claude Code