Redirect to login when token refresh fails on 401#3248
Draft
rossnelson wants to merge 13 commits intomainfrom
Draft
Redirect to login when token refresh fails on 401#3248rossnelson wants to merge 13 commits intomainfrom
rossnelson wants to merge 13 commits intomainfrom
Conversation
…weirdness in control flow.
…ve single points of access
…Re-wire with-access-token to use pre/post hooks so code paths can be determined by the caller. Lots of tests
…tions as well as a few others
When ossPostResponse receives a 401 and refreshTokens returns false, redirect the browser to the login page so expired sessions don't silently fail — particularly for background requests that bypass handleError. Add unit tests for the redirect behavior and a Playwright integration test covering the full session-expiry redirect flow.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
split('=')[1] drops any '=' padding characters in the base64-encoded
cookie value. Switch to indexOf('=') to correctly preserve them.
Add tests covering both the happy path and a value with '=' padding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ossPostResponsewhen a 401 response can't be recovered via token refreshhandleErrorwould silently fail on session expiry instead of redirecting to loginBROWSERguard to keep the redirect SSR-safeTests
oss-provider.test.ts(redirect fires on failed refresh, not on non-401)request-from-api.integration.test.tswithwindow.locationproperly stubbedoauth-flow.spec.tscovering the full session-expiry → redirect flowNotes
Depends on / intended to merge after #FixAuthWeirdNessCookieVersion.