Skip to content

fix(account): keep the rotated refresh token when a sign-out can't revoke - #266

Merged
alexkroman merged 1 commit into
mainfrom
aawoyemi/fix/PE-2657/sign-out-keeps-rotated-token
Oct 29, 2026
Merged

alexkroman merged 1 commit into
mainfrom
aawoyemi/fix/PE-2657/sign-out-keeps-rotated-token

Conversation

@damafeez

Copy link
Copy Markdown
Contributor

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 got invalid_grant too. So after a failed sign-out:

  • the next renewal or retry was refused, and Blurt signed the Mac out locally;
  • server-side, the connection and its API key stayed live until the key expired.

The fix keeps the rotated refresh token before calling revoke, the same way renew already 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.sh passes

  • I read AGENTS.md and this doesn't reintroduce anything deliberately removed

  • Docs updated if behavior changed (no doc change needed)

🤖 Generated with Claude Code

…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
alexkroman merged commit 5cebea3 into main Oct 29, 2026
13 checks passed
@alexkroman
alexkroman deleted the aawoyemi/fix/PE-2657/sign-out-keeps-rotated-token branch October 29, 2026 15:57
@alexkroman alexkroman mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants