Description
AWS::BedrockAgentCore::OAuth2CredentialProvider supports RFC 8693 token exchange via Oauth2ProviderConfigInput.CustomOauth2ProviderConfig.OnBehalfOfTokenExchangeConfig, with allowed GrantType values TOKEN_EXCHANGE | JWT_AUTHORIZATION_GRANT and a nested TokenExchangeGrantTypeConfig. Source: OnBehalfOfTokenExchangeConfig CFN docs, CustomOauth2ProviderConfigInput docs.
This lets a Gateway Target (or any AgentCore caller using OAuth2 outbound auth) present an inbound JWT and receive a downstream token suitable for the upstream service — i.e. on-behalf-of flow.
The CLI does not surface this:
OAuthCredentialProvider schema in agentcore-project.ts:195–208 has only discoveryUrl, scopes, vendor, managed, usage — no token-exchange fields.
- The L3 construct (
@aws/agentcore-cdk — src/cdk/constructs/components/mcp/Gateway.ts:255–267) hardcodes grantType: 'CLIENT_CREDENTIALS' when wiring oauthCredentialProvider on a target.
- This is exposed only on the Custom OAuth2 provider config in CFN — built-in vendor providers (Google, GitHub, Slack, Salesforce, Microsoft, Atlassian, etc.) do not support token exchange.
This is referenced in the user ask as "Token Exchange — Target & Credential" (the credential-provider side and the gateway-target side both need plumbing).
Acceptance Criteria
Additional Context
Description
AWS::BedrockAgentCore::OAuth2CredentialProvidersupports RFC 8693 token exchange viaOauth2ProviderConfigInput.CustomOauth2ProviderConfig.OnBehalfOfTokenExchangeConfig, with allowedGrantTypevaluesTOKEN_EXCHANGE | JWT_AUTHORIZATION_GRANTand a nestedTokenExchangeGrantTypeConfig. Source: OnBehalfOfTokenExchangeConfig CFN docs, CustomOauth2ProviderConfigInput docs.This lets a Gateway Target (or any AgentCore caller using OAuth2 outbound auth) present an inbound JWT and receive a downstream token suitable for the upstream service — i.e. on-behalf-of flow.
The CLI does not surface this:
OAuthCredentialProviderschema inagentcore-project.ts:195–208has onlydiscoveryUrl,scopes,vendor,managed,usage— no token-exchange fields.@aws/agentcore-cdk—src/cdk/constructs/components/mcp/Gateway.ts:255–267) hardcodesgrantType: 'CLIENT_CREDENTIALS'when wiringoauthCredentialProvideron a target.This is referenced in the user ask as "Token Exchange — Target & Credential" (the credential-provider side and the gateway-target side both need plumbing).
Acceptance Criteria
OAuthCredentialProviderSchema(agentcore-project.ts:195–208) with an optionaltokenExchangeblock:grantType: 'TOKEN_EXCHANGE' | 'JWT_AUTHORIZATION_GRANT'(one-of)tokenExchangeGrantTypeConfig— match the CFN sub-shape (subject token URI/types, audience, etc. — finalize from CFN docs).vendor: 'CustomOauth2'(CFN does not support it on built-in providers).--token-exchange-grant-type,--token-exchange-config-file <path>(JSON file for the nested struct), or stage these via rawagentcore.jsonedits initially.grantTypeto be passed through (replace hardcoded'CLIENT_CREDENTIALS'in@aws/agentcore-cdkGateway.ts:255–267 with the schema field).grantType: 'TOKEN_EXCHANGE'is only paired with credential providers that have the token-exchange config set.Additional Context
Oauth2ProviderConfigInput.CustomOauth2ProviderConfig.OnBehalfOfTokenExchangeConfig(Custom OAuth2 only).@aws/agentcore-cdkhardcodesgrantType: 'CLIENT_CREDENTIALS'; needs to flow through from schema.