modelcontextprotocol / modelcontextprotocol/typescript-sdk
OAuth Request Should Accept client_id and client_secret via Headers, Not Just in the Request Body
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
Describe the bug
When attempting to integrate with the OpenAI connector, the /token request fails because OpenAI sends the client_id and client_secret via the Authorization header, not in the request body.
The body /token request looks like this:
{
"grant_type": "authorization_code",
"code": "62cd621bf6e44fd88be3f98f3a8aba37",
"redirect_uri": "https://chatgpt.com/connector_platform_oauth_redirect",
"code_verifier": "mBLha_DC8fq_tnLSk3sWF0kpi3sda8yKKpsr_4k3vo"
}
Since the credentials are not in the body, the server does not recognize them and the authentication fails.
To Reproduce
Steps to reproduce the behavior:
- Attempt to integrate with the OpenAI connector.
- Use
ProxyOAuthServerProviderfor handling the/tokenrequest. - Observe the failure due to missing credentials in the request body.
Expected behavior
From the code here, it appears that the implementation only reads client_id and client_secret from the request body.
This works for many clients, but fails in the case of OpenAI, which uses the Authorization header instead. The server should support extracting these credentials from the Authorization header (typically using Basic Auth) as well as from the body to ensure broader compatibility.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/server/auth/middleware/clientAuth.ts at the referenced credential-extraction logic. Reproduce a ProxyOAuthServerProvider /token request using the OpenAI connector pattern, where client_id and client_secret arrive through the Authorization header rather than the body. The work is done when header-based credentials are accepted while existing body-based requests continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100