首页 文章

Postman for Api Gateway中的设置标头如何通过Cognito进行身份验证?

提问于
浏览
4

我使用AWS Identity Pool和Facebook提供商来验证客户端 . 我需要使用Api Gateway调用AWS Lambda . 从Cognito,使用Facebook令牌,我收到了凭证:AccessKeyId,SecretKey和SessionToken .

使用此凭据,我应该如何设置标头请求来调用我的Lambda?

Api网关设置(测试调用我的lambda)

enter image description here

我尝试调用我的api,它返回“请求中包含的安全令牌无效” .

enter image description here

谢谢!

3 回答

  • 2

    您必须在Postman中手动设置“ x-amz-security-token ”并在该标头中传递令牌 .

  • 2

    请为邮递员试试这个:

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

    在“授权”下拉列表中选择 AWS Signature 选项,并使用密钥和密码填写字段,单击“更新” . 邮差将为您签署请求 .

    并确保分配给您的cognito用户的角色可以访问调用apig .

  • 2

    JoshuaCVijayanath Viswanathan 谢谢你们俩 . 根据您的建议,我解决了这个问题 .

    我做了以下步骤:

    • 设置 AWS Signature 并单击“ Update Request

    enter image description here

    • 使用 SessionToken 添加 Headers “ X-Amz-Security-Token

    enter image description here

相关问题