Skip to content

OAuthClientProvider._handle_token_response expect json #1523

@cfytrok

Description

@cfytrok

Initial Checks

Description

token_response = OAuthToken.model_validate_json(content)

OAuthClientProvider._handle_token_response expects JSON, but doesn't specify this in the headers. If the server responds in a different format, an exception will be raised.

For example, https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#2-users-are-redirected-back-to-your-site-by-github
access_token endpoint by default returns form-data and requires the Accept: application/json header to return json.

Example Code

Python & MCP Python SDK

python 3.11.9
mcp=1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions