Title: fix(oauth): preserve existing refresh_token when refresh response omits it by oedokumaci · Pull Request #2271 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix(oauth): preserve existing refresh_token when refresh response omits it by oedokumaci · Pull Request #2271 · modelcontextprotocol/python-sdk
X Title: fix(oauth): preserve existing refresh_token when refresh response omits it by oedokumaci · Pull Request #2271 · modelcontextprotocol/python-sdk
Description: Fixes #2270 Per RFC 6749 Section 6, the authorization server MAY issue a new refresh token in the refresh response. When it doesn't, _handle_refresh_response overwrites the stored token as-is, discarding the existing refresh_token. After the first successful refresh, can_refresh_token() returns False and subsequent refreshes fail. This preserves the existing refresh_token when the response omits one, using model_copy(update=...). Also removes # pragma: no cover from _handle_refresh_response (added in a bulk coverage baseline, not intentional) and adds tests covering all branches: success with preservation, success with rotation, no prior tokens, non-200 failure, and invalid JSON. Note: #2270 hasn't received the ready for work label yet. Submitting this early since the fix is small and self-contained. Happy to wait or adjust based on maintainer feedback.
Open Graph Description: Fixes #2270 Per RFC 6749 Section 6, the authorization server MAY issue a new refresh token in the refresh response. When it doesn't, _handle_refresh_response overwrites the stored token as-is, ...
X Description: Fixes #2270 Per RFC 6749 Section 6, the authorization server MAY issue a new refresh token in the refresh response. When it doesn't, _handle_refresh_response overwrites the stored token as-...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2271
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6fbed52b-e0f0-bafc-5438-24c5c8d0eb05 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BEFE:192070:1C3788:2798F1:6A5A4543 |
| html-safe-nonce | 1f4c3b8e71be1c281b80519a33d29537470acf69050c573fe2d05f7c72a39852 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUZFOjE5MjA3MDoxQzM3ODg6Mjc5OEYxOjZBNUE0NTQzIiwidmlzaXRvcl9pZCI6IjY4MDkwOTcyNzE0NTgyODQ4NjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 65ab15328e1881486028e6b89f492eccf50b1876e33090299929bf7674ef8f7d |
| hovercard-subject-tag | pull_request:3384504801 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2271/files |
| twitter:image | https://avatars.githubusercontent.com/u/13405528?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/13405528?s=400&v=4 |
| og:image:alt | Fixes #2270 Per RFC 6749 Section 6, the authorization server MAY issue a new refresh token in the refresh response. When it doesn't, _handle_refresh_response overwrites the stored token as-is, ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a793cd1fa898929111edad5857ee1f24ecf4bf7702525e67357cabc9df136fc3 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5aec27bb9c4f7ebe5fbbcd1533a5509e63a570a1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width