-
Notifications
You must be signed in to change notification settings - Fork 614
[BUG][AUTH]: OAuth providers return opaque tokens instead of JWT tokens #2149
Copy link
Copy link
Labels
Milestone
Description
Problem
OAuth providers that support both opaque and JWT access tokens (such as BetterAuth, Auth0, etc.) return
opaque tokens by default when the RFC 8707 resource parameter is not included in the token request.
This causes MCP servers expecting JWT tokens to fail with "Invalid Compact JWS" errors when attempting
to verify the opaque token.
Current Behavior
- User initiates OAuth flow via
/oauth/authorize/{gateway_id} - OAuth provider redirects to
/oauth/callbackwith authorization code - Context Forge exchanges code for access token WITHOUT
resourceparameter - OAuth provider returns opaque token (single string, 1 part)
- MCP server attempts JWT verification → fails with
ERR_JWS_INVALID
Expected Behavior
- Context Forge includes RFC 8707
resourceparameter in token request - OAuth provider returns JWT token (3 parts: header.payload.signature)
- MCP server successfully verifies JWT token
Proposed Solution
Implement RFC 8707 Resource Indicators support:
- Set
resourceparameter togateway.url(the MCP server URL) - Include
resourcein both authorization URL and token exchange request - Works automatically for all OAuth gateways, no configuration needed
Impact
- Affects all OAuth-enabled gateways using providers that support both token types
- No breaking changes - transparent enhancement
- Enables JWT token verification for MCP servers
RFC Reference
Reactions are currently unavailable