IssueRaiser

How to find the bidirectional map between Cognito identity ID and Cognito user information?

Given the Cognito identity ID, I would like to programmatically find the user name, e-mail address, etc. For example, one issue is that each user gets his/her own folder in S3 (e.g. `private/${cognito-identity.amazonaws.com:sub}/` according to the `myproject_userfiles_MOBILEHUB_123456789` IAM policy) but I cannot relate that folder name (S3 prefix) to the user attributes in my user pool. The closest thing that I have found is this rather complicated code: [AWS Lambda API gateway with Cognito - how to use IdentityId to access and update UserPool attributes?](https://stackoverflow.com/q/42386180/341970) Is it my best bet? Is it really this difficult? (As a workaround, I would be happy with a post confirmation lambda trigger that creates for example a `${cognito-identity.amazonaws.com:sub}/info.txt` file in some S3 bucket, and in the info.txt file it could place the user sub from the user pool. I am not sure that this is feasible at all, it was just an idea.)

Posted by baharev on Dec 10, 2017, 11:17 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

ux (Other)

How to find the bidirectional map between Cognito identity ID and Cognito user information?

baharevDec 10, 2017, 11:17 PM

Given the Cognito identity ID, I would like to programmatically find the user name, e-mail address, etc. For example, one issue is that each user gets his/her own folder in S3 (e.g. `private/${cognito-identity.amazonaws.com:sub}/` according to the `myproject_userfiles_MOBILEHUB_123456789` IAM policy) but I cannot relate that folder name (S3 prefix) to the user attributes in my user pool. The closest thing that I have found is this rather complicated code: [AWS Lambda API gateway with Cognito - how to use IdentityId to access and update UserPool attributes?](https://stackoverflow.com/q/42386180/341970) Is it my best bet? Is it really this difficult? (As a workaround, I would be happy with a post confirmation lambda trigger that creates for example a `${cognito-identity.amazonaws.com:sub}/info.txt` file in some S3 bucket, and in the info.txt file it could place the user sub from the user pool. I am not sure that this is feasible at all, it was just an idea.)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue