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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…