Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How setup header in Postman for Api Gateway authenticated with Cognito?

I use AWS Identity Pool with Facebook provider to authenticate client. I need to invoke AWS Lambda using Api Gateway. From Cognito, using Facebook token, i received credentials: AccessKeyId, SecretKey and SessionToken.

Using this credentials, how should I setup header request to invoke my Lambda?

Api Gateway setup (test calls my lambda)

enter image description here

I try to call my api, it returns "The security token included in the request is invalid."

enter image description here

Thank you!

like image 877
Alexander Karpov Avatar asked Oct 24 '17 21:10

Alexander Karpov


2 Answers

You have to manually set 'x-amz-security-token' in Postman and pass the token in that header.

like image 139
Vijayanath Viswanathan Avatar answered Sep 21 '22 18:09

Vijayanath Viswanathan


Please try this for postman:

http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-use-postman-to-call-api.html

you choose the AWS Signature option in the Authorization drop-down, and fill out the fields using the key and secret, click update. Postman will sign the request for you.

And also make sure the role being assigned to your cognito users has access to invoke apig.

like image 43
JoshuaC Avatar answered Sep 23 '22 18:09

JoshuaC