Repository navigation
fix(account): keep the rotated refresh token when a sign-out can't revoke - #266
Merged
alexkroman merged 1 commit intoOct 29, 2026
Merged
Conversation
…voke Sign Out refreshes for an access token, then revokes. When the revoke failed (offline, 503), Blurt kept the pre-refresh token, which the refresh had already retired. The authorization server treats presenting a retired refresh token as reuse and ends the grant, so the next renewal was refused and signed the Mac out locally, while the connection and its key stayed live server-side. Keep the rotated token before revoking, as renewal already does, so a retry or a renewal uses a token that works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexkroman
deleted the
aawoyemi/fix/PE-2657/sign-out-keeps-rotated-token
branch
October 29, 2026 15:57
Merged
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.
What & why
Sign Out refreshes to get an access token, then calls revoke with it. If the revoke failed (offline, or a 503 from the server), Blurt correctly said "couldn't confirm, still connected", but it kept the refresh token from before the refresh, which the refresh had already retired.
The authorization server treats a retired refresh token as reuse: it refuses that token and also ends the current one. We saw this against production, where sending a rotated-away token got
invalid_grant, and the newest token gotinvalid_granttoo. So after a failed sign-out:The fix keeps the rotated refresh token before calling revoke, the same way
renewalready does. It's guarded by the account's generation, so a sign-out that something else ended meanwhile doesn't write a session back.How it was tested
Extended
signOutUnconfirmed. After a failed revoke, the stored refresh token is the rotated one, and a retry refreshes with it (["rt-1", "rt-2"]) and signs out. Both expectations fail without the fix and pass with it.Production lifecycle checked by script: sign-in → exchange → refresh rotation → revoke → the key is disabled, refresh is refused and exchange is refused.
scripts/check.shpassesI read AGENTS.md and this doesn't reintroduce anything deliberately removed
Docs updated if behavior changed (no doc change needed)
🤖 Generated with Claude Code