Skip to content

auth/extauth: send resource in client credentials token requests - #1451

Merged
guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
shlee1223:extauth-client-credentials-resource
Oct 28, 2026
Merged

guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
shlee1223:extauth-client-credentials-resource

Conversation

@shlee1223

@shlee1223 shlee1223 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

ClientCredentialsHandler omits resource from its token request, unlike AuthorizationCodeHandler.
The MCP authorization spec requires it in token requests. This passes prm.Resource via EndpointParams and adds a test.

Tests: added TestClientCredentialsHandler_TokenRequestIncludesResource, which fails without the fix.
go test -race ./auth/... ./oauthex/... passes.

AI disclosure: I used Claude Code to help find this; I reviewed and tested the change myself.

Fixes #1450

@ratomirjovanovic ratomirjovanovic left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This matches what AuthorizationCodeHandler already sends, and since cfg is also what the reused token source refreshes with, the later client credentials requests carry resource too, not only the first one. prm.Resource can't be empty here: it is either the validated PRM value or the server URL from the 2025-03-26 fallback.

A related question, not for this PR: EnterpriseHandler's JWT bearer step (exchangeJWTBearer) sends only grant_type and assertion to the MCP authorization server. The resource is already inside the ID-JAG from the token exchange, so that may be intended, but if the MCP authorization server is expected to see resource on every token request, that step would need the same treatment.

@guglielmo-san
guglielmo-san merged commit 12955fe into modelcontextprotocol:main Oct 28, 2026
9 checks passed
@guglielmo-san

Copy link
Copy Markdown
Contributor

@shlee1223 thank you for the contribution!

luiacuaniello added a commit to luiacuaniello/go-sdk that referenced this pull request Oct 28, 2026
Resolve a conflict in auth/extauth/client_credentials_test.go: modelcontextprotocol#1451 and
this branch each added a test right before TestSelectTokenAuthMethod.
Both tests are kept, unchanged.
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.

auth/extauth: ClientCredentialsHandler does not send the resource parameter

3 participants