I see in the API Gateway FAQ that it is possible to access the request headers sent to the API Gateway...
If you already utilize OAuth tokens or any o
First, you need to trap the Authorization
header from the HTTP GET request. Then you need to map that value to the Lambda event object.
Go to the API method dashboard and click on Method Request. In there you can add an HTTP Request Header
called Authorization
as shown below.
This will trap the Authorization
header so you can use it later.
Now go back to the method dashboard and click on Integration Request
. From here you can pass the value of the header into the Lambda function by using a mapping like this.
{
"Authorization": "$input.params('Authorization')"
}
Now in your Lambda function you can get the value like this.
event.Authorization