Reputation: 831
I created a usage plan, associated it to the default stage and created an API key.
Then I created authorizer pointing to my Lambda function and set identity source to header
and called it key
.
I disabled authorization catching.
Then I went to my method request, I choose my authorizer and switched API Key Required to true
.
I also added key
header to HTTP Request Headers.
I deployed API, and after making a call with Postman I'm getting two different responses:
key
in headers: { "message": "Unauthorized"}
key
in headers: { "message": null}
Whenever I post key
in the header, I'm getting such response no matter what the content of the key
is. Obliviously I'm using a previously generated API key.
What I'm missing here?
Upvotes: 1
Views: 576
Reputation: 1907
AWS supports two types of authentication mechanism for api gateway
Using cognito user pools
using custom authorizer
you have to use one of them or it will return null for a sample authorizer function you can refer to an example in github repository
Upvotes: 1