How to pass cognito user information to lambda?

前端 未结 1 1510
臣服心动
臣服心动 2021-01-12 05:16

I\'m developing application based on API Gateway and Lambda. I configured POST /subscribe as \"AWS_IAM\". So now it cannot accessible directly, but I can access to API with

相关标签:
1条回答
  • 2021-01-12 05:59

    You can get the Cognito Identity ID from the identity property of the context parameter (context.identity) as explained in the context Object Properties section of the Lambda Programming Model help topic. Once you have the Cognito unique identifier, you can use Cognito Sync's APIs with your developer credentials to look up information stored about this user in Cognito or you can use that identifier to map the ID to user information stored in elsewhere.

    Make sure that API Gateway is configured for AWS_IAM (as you mentioned) and make sure that "Invoke with caller credentials" is checked under the method's "Integration Request" settings.

    0 讨论(0)
提交回复
热议问题