- I’m trying to propagate an access token from the incoming request through the gateway to the target service.
- Currently, I have configured the outbound auth as the OAuth client and I want to override the token generated from this authorizer by the token incoming in the gateway request through the interceptor.
- I have written the following request interceptor, but when the agent invoked the gateway the token didn't propagate to the target and the outbound OAuth token is being used.
- Is there a configuration step I’m missing that prevents an interceptor from overriding outbound OAuth headers? Or is outbound OAuth always applied after the interceptor runs?
def lambda_handler(event, context):
mcp_data = event.get('mcp', {})
gateway_request = mcp_data.get('gatewayRequest', {})
headers = gateway_request.get('headers', {})
credentials = headers.get('authorization', '') or headers.get('Authorization', '')
return {
"interceptorOutputVersion": "1.0",
"mcp": {
"transformedGatewayRequest": {
"headers": {
"Authorization": credentials,
},
"body": event['mcp']['gatewayRequest']['body']
}
}
}