Skip to content

fix: preserve OAuth authorization endpoint query params#2819

Open
Zhang-986 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Zhang-986:codex/oauth-auth-endpoint-query
Open

fix: preserve OAuth authorization endpoint query params#2819
Zhang-986 wants to merge 1 commit into
modelcontextprotocol:mainfrom
Zhang-986:codex/oauth-auth-endpoint-query

Conversation

@Zhang-986

Copy link
Copy Markdown

Summary

  • preserve existing query parameters on OAuth authorization endpoints when building the redirect URL
  • append SDK-generated authorization request parameters with proper URL query encoding
  • add a regression test for authorization endpoints such as /authorize?prompt=select_account

Fixes #2776.

Tests

  • uv run --frozen pytest tests/client/test_auth.py -k authorization_endpoint_query_params_are_preserved (fails before the fix, passes after)
  • uv run --frozen pytest tests/client/test_auth.py
  • uv run --frozen ruff check src/mcp/client/auth/oauth2.py tests/client/test_auth.py
  • uv run --frozen pyright src/mcp/client/auth/oauth2.py tests/client/test_auth.py
  • git diff --check

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.

OAuth handler doesn't support redirect URLs with params

1 participant