I've set up an API with a single method on AWS API gateway to an HTTP service using a VPC link.
I've also set up a TOKEN custom authorizer for that API method using Lambda.
The custom authorizer is based on the AWS Node.js custom authorizer blueprint, where I'm basically allowing all methods through and returning a 'context' section along with an IAM.
{
"principalId": "user|a1b2c3d4",
"policyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Effect": "Allow",
"Resource": [
"arn:aws:execute-api:[region]:[account_id]:[restApiId]/[stage]/*/*"
]
}
]
},
"context": {
"key": "new-token",
"number": 1,
"bool": true
}
}
That's the result from the Lambda when I test it, both on the Lambda test console and one the API gateway custom authorizer console.
Finally, I mapped the Authorization header to 'context.authorizer.key' in the Integration Request section.
Now, when I execute the request, I expect that the Authorization header would be populated with the value from the 'context' section of the authorizer's response, but it's never populated.
What am I doing wrong?
event
? – Noel Llevaresevent
contains that token. I have no way of telling what the Lamda authorizer receives when I use it through the Api Gateway. That's where I have no visibility, unless you can suggest something. – Ramesh Muraleedharanconsole.log(event)
inside your main Lambda (NOT the authorizer Lambda) and look for it in CloudWatch. – Noel Llevares