| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…response Per RFC 6749 Section 6, the authorization server MAY issue a new refresh token in the refresh response. When it does not, the client must preserve the existing one. The current implementation replaces current_tokens with the parsed response as-is, which discards the stored refresh_token when the server omits it. After the first successful refresh, can_refresh_token() returns False and all subsequent refreshes fail, forcing full re-authentication. Many OAuth providers omit refresh_token from refresh responses by default (Google, Auth0 without rotation, Okta in persistent mode). Github-Issue: #2270
…response Per RFC 6749 Section 6, issuing a new refresh token in the refresh response is optional. Many OAuth providers omit it by default (Google, Auth0 without rotation enabled, Okta in persistent token mode). This fix checks if the refresh response omits refresh_token and preserves the existing one to prevent auth failures after the first refresh. Fixes modelcontextprotocol#2304
|
Thanks for your contribution! Closing this in favour of #2271 as that predates this PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
_handle_refresh_response() replaces current_tokens with the parsed refresh response as-is. When the authorization server does not return a new refresh_token in the response, the previously stored one is lost.
After the first successful refresh, can_refresh_token() returns False and all subsequent refreshes fail, forcing full re-authentication.
Per RFC 6749 Section 6, issuing a new refresh token in the refresh response is optional. Many OAuth providers omit it by default (Google, Auth0 without rotation enabled, Okta in persistent token mode).
Fix
Before overwriting current_tokens, check if the refresh response omits refresh_token. If so, preserve the existing one using model_copy(update=...).
This matches the RFC wording: if a new refresh token is issued, replace the old one; otherwise keep using the existing one.
Fixes #2270