Title: Support granular OAuth2 flow with state and verifier persistence · Issue #992 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Support granular OAuth2 flow with state and verifier persistence · Issue #992 · modelcontextprotocol/python-sdk
X Title: Support granular OAuth2 flow with state and verifier persistence · Issue #992 · modelcontextprotocol/python-sdk
Description: Currently, the OAuth2 PKCE implementation in src/mcp/client/auth.py stores the state and code_verifier in memory only, which prevents splitting the OAuth authorization flow across multiple processes. This is common for apps with servers ...
Open Graph Description: Currently, the OAuth2 PKCE implementation in src/mcp/client/auth.py stores the state and code_verifier in memory only, which prevents splitting the OAuth authorization flow across multiple processe...
X Description: Currently, the OAuth2 PKCE implementation in src/mcp/client/auth.py stores the state and code_verifier in memory only, which prevents splitting the OAuth authorization flow across multiple processe...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/992
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support granular OAuth2 flow with state and verifier persistence","articleBody":"Currently, the OAuth2 PKCE implementation in [src/mcp/client/auth.py](https://github.com/modelcontextprotocol/python-sdk/blob/d0443a18328a2fc9e87da6feee9130f95c0b37a7/src/mcp/client/auth.py#L312-L313) stores the `state` and `code_verifier` in memory only, which prevents splitting the OAuth authorization flow across multiple processes.\n\nThis is common for apps with servers split between frontend and backend where BE cannot be blocked on a UI action. The UI first requests the server to generate the link, and the server processes the callback separately once the user follows it. The `state` and `code_verifier` are persisted between the calls with a short expiration time.\n\nProposal:\n* Add support for persisting the state and code_verifier values, e.g. through the `redirectHandler`, and looking them up in the `callbackHandler` for the final token exchange.\n* Allowing more granular execution of the flow - `generateUrl`, and `exchangeToken` should be callable individually.\n","author":{"url":"https://github.com/andrey-star","@type":"Person","name":"andrey-star"},"datePublished":"2025-06-20T14:41:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/992/python-sdk/issues/992"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ee191ab5-e773-66e7-bbe1-371de3251a09 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89C0:29A644:DDED96:11E58D8:6A5C2881 |
| html-safe-nonce | 8b0a97de3d15fbee8419ddd19d2e02241c28aade3757c5a413e18fe2ed06edbb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUMwOjI5QTY0NDpEREVEOTY6MTFFNThEODo2QTVDMjg4MSIsInZpc2l0b3JfaWQiOiIyMTM5NTcxODE3NTE0MDE4OTQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 966aef87baac75e1998853ff69354f4ef3d1a9ae362fe2aa9569905aa5e3f93d |
| hovercard-subject-tag | issue:3163568221 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/modelcontextprotocol/python-sdk/992/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fed05fd6f3aae6954ba40d4fdbc7b2ff051ddef6c5bd92e36856678f4291d6e4/modelcontextprotocol/python-sdk/issues/992 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fed05fd6f3aae6954ba40d4fdbc7b2ff051ddef6c5bd92e36856678f4291d6e4/modelcontextprotocol/python-sdk/issues/992 |
| og:image:alt | Currently, the OAuth2 PKCE implementation in src/mcp/client/auth.py stores the state and code_verifier in memory only, which prevents splitting the OAuth authorization flow across multiple processe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | andrey-star |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width