How setup header in Postman for Api Gateway authen

2020-03-01 18:33发布

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!

3条回答
够拽才男人
2楼-- · 2020-03-01 19:24

JoshuaC and Vijayanath Viswanathan thank you both. Following your suggestion I resolved the issue.

I did the follow steps:

  1. Setup AWS Signature and click on "Update Request"

enter image description here

  1. Add in header "X-Amz-Security-Token" with SessionToken

enter image description here

查看更多
走好不送
3楼-- · 2020-03-01 19:28

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

查看更多
劳资没心,怎么记你
4楼-- · 2020-03-01 19:32

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.

查看更多
登录 后发表回答