Repository navigation
fix: stop session refresh after sign-out - #141
Merged
Merged
Conversation
|
nicknisi
approved these changes
Sep 29, 2026
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
Stop the SDK from refreshing after
signOut()clears its session credentials. Previously the refresh timer remained active and the client remained authenticated, so a timer firing before navigation completed (or aftersignOut({ navigate: false })) could submit a refresh grant without a refresh token.SIGNED_OUTand cancel its timer after constructing the logout URL, before clearing credentials.LoginRequiredErrorinstead of making requests.Logout navigation,
returnTohandling, andNoSessionErrorbehavior are unchanged. Already-sent network requests are not aborted; their results are ignored by the signed-out client. This does not change initialization on the page loaded after a redirect.Validation
Using Node 20.20.2 (the CI Node major):
npm test -- --runInBand --runTestsByPath src/create-client.test.ts— 61 passed, including 9 new cases covering both navigation modes, explicit refresh calls, late 200/400/503 responses, and lock acquisition/timeout after logout.npm run build— passed, including declaration generation.npx --no-install prettier --check src/create-client.ts src/create-client.test.ts— passed.git diff --check— passed.Tests use synthetic sessions, mocked network/navigation, and controlled timers; no live customer session was changed. Full-repository tests are left to CI.
npm cireported 16 existing dependency audit findings (3 low, 4 moderate, 8 high, 1 critical). Dependencies and the lockfile are unchanged in this PR.Requested by kathleen.brandt@workos.com in Slack (TARS chain)