Skip to content

fix: ProxyOAuthServerProvider: redirect_uri missing in token request #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

shubham-lohar
Copy link
Contributor

Fixes #479: a critical issue in ProxyOAuthServerProvider where the redirect_uri parameter was missing from the token exchange request, causing token endpoints (like Amazon Cognito) to return 400/500 errors.

Motivation and Context

Issue: The ProxyOAuthServerProvider did not include the redirect_uri parameter in the /token request, violating the OAuth 2.0 spec.
Impact: This caused token endpoints to fail, preventing successful token exchanges.
Why Fix: The redirect_uri is required by the OAuth 2.0 spec and must match the one used during the /authorize request.

How Has This Been Tested?

Unit Tests: Added tests to verify that the redirect_uri is included in the token request.

Breaking Changes

None: This is a bug fix that does not change the public API or behavior of the ProxyOAuthServerProvider.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Implementation Notes: The fix updates the exchangeAuthorizationCode method to include the redirect_uri parameter in the token request.
Design Decisions: Ensured the fix adheres to the OAuth 2.0 spec and maintains backward compatibility.

@benbourdel
Copy link

+1 I have the same trouble on my side

@ihrpr ihrpr added this to the HPR milestone May 21, 2025
Copy link
Contributor

@pcarleton pcarleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for this!

@pcarleton pcarleton merged commit 1d860bb into modelcontextprotocol:main May 21, 2025
2 checks passed
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.

ProxyOAuthServerProvider: redirect_uri missing in token request
4 participants