Fix OAuth refresh token persistence for non-rotating servers - #373
Merged
Conversation
Non-rotating OAuth servers return refresh_token only during initial auth and omit it from refresh responses. The bridge's onTokenRefresh callback rebuilt the keychain record from the raw response, erasing the stored refresh token, so the session died with an auth error once the access token expired and required a fresh login. OAuthTokenManager already tracks the effective refresh token internally; it now passes it to the onTokenRefresh persistence callback, so every caller (bridge and CLI) persists the preserved token. The CLI path's own fallback stays as defense in depth. Fixes #371 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018RBge8dGQAm7PJ5ap6FY7M
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.
Sessions no longer lose their saved OAuth refresh token when a non-rotating server omits
refresh_tokenfrom the refresh response. The bridge's persistence callback rebuilt the keychain record from the raw response, erasing the stored token, so the session required a newmcpc loginonce the access token expired.OAuthTokenManagernow passes the effective refresh token (rotated or preserved) to theonTokenRefreshpersistence callback, fixing the bridge and any future caller in one placeFixes #371
https://claude.ai/code/session_018RBge8dGQAm7PJ5ap6FY7M