Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Api Gateway Authorizer + Cognito User Pool Not Working {"message": "Unauthorized"}

Tags:

I am trying to use aws api gateway authorizer with cognito user pool. It is working fine when i test using aws api gateway console.

But when i try enabling the authorization in the api it says "message": "Unauthorized". Please check below screenshot

API Gateway Console Screenshot - This works fine enter image description here

Postman Screen shot - Not working enter image description here

Can someone help please.

FYI I have followed the instructions as mentioned here http://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html

like image 967
Manivannan Guru Avatar asked Sep 21 '17 13:09

Manivannan Guru


People also ask

How do I authenticate a Cognito user?

AWS Cognito User Pool will send verification code by email or sms and the user enters the code to get verified with the User Pool. User enters username and password and logs in with Cognito User Pool in which case a token will be provided by Cognito upon successful login.

Can Cognito be used as authorization?

Amazon Cognito enables simple, secure user authentication, authorization and user management for web and mobile apps. With Cognito, a user or visitor can sign in with a username and password through Amazon, or through a third party like Facebook, Google or Apple.


1 Answers

In my case, authorization code should be id_token. I made a mistake for using access_token instead

like image 157
Long Nguyen Avatar answered Sep 29 '22 11:09

Long Nguyen