Reputation: 113
I have created a Cognito user pool authorizer for an API Gateway service that invokes a lambda function. The Authorizer is getting completely ignored and I am able to invoke the service without any token. I have deployed the service multiple times. I have created multiple gateway APIs and still see the same issue.
On comparing with an older API where I have the Authorizer working the only difference I could see is that that when I check the Resource tab in the API. The old service method (POST) shows Authorization: COGNITO_USER_POOL and all the new APIs show Authorization: None. Is something broken with the API Gateway or am I missing a step.
Upvotes: 1
Views: 2824
Reputation: 79
@Arka MUkherjee, I believe that your answer is not exactly what the question asked.
The question asked why -- if we follow the steps you've outlined above -- we do not see the Cognito Authorizer that we have just created in the pull-down list that we select from in your step 6.
One reason, I've just found out, is that you have to wait a good number of minutes between the time you create the Cognito Authorizer and the time that it will show up in the pull down list. It does show up, but typically it's about 5-15 minutes after you've created the Cognito Authorizer.
Upvotes: 3
Reputation: 2300
To fix this, you should do the following steps:
And yes, you are indeed right. You are facing the problem of the Authorizer not functioning because the Authorizer is not linked to the REST API. To link it, you would need to do it manually from the Method Request Tab. Another point to note is that Authorizers can be re-used between multiple REST APIs in API Gateway.
Upvotes: 4