Repository navigation
auth/extauth: send resource in client credentials token requests - #1451
guglielmo-san merged 2 commits into
Conversation
ratomirjovanovic
left a comment
There was a problem hiding this comment.
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.
|
@shlee1223 thank you for the contribution! |
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.
ClientCredentialsHandler omits
resourcefrom its token request, unlike AuthorizationCodeHandler.The MCP authorization spec requires it in token requests. This passes
prm.ResourceviaEndpointParamsand 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