curious
curious

Reputation: 831

How to authenticate with API Gateway?

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:

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

Answers (1)

varnit
varnit

Reputation: 1907

AWS supports two types of authentication mechanism for api gateway

  1. Using cognito user pools

  2. 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

Custom Authorizer Api Gateway

Upvotes: 1

Related Questions