'How can I get user info (all details) from AWS Amplify (Auth) with only username(email)?
I am using AWS Amplify (Auth) and I want to get user details with only username(email). Is there any way to get user details before signing in?
I am following these docs: https://docs.amplify.aws/lib/auth/getting-started/q/platform/js/
Solution 1:[1]
You can get the user info by going to the Amplify AdminUI -> User Management and typing the username (email) of the user.
Now you have the unique id. of the user. Depending on how you setup your DynamoDB, you can use either that id you found or the email to search for the user. For example you could create a lambda function that at user signup creates an entry on DynamoDB and the id is the same as the one you find on User Management on Amplify AdminUI or it could be the email... up to you.
Solution 2:[2]
Specify User Details. Are you talking about the current logged in user or ANY user in your congito user pool?
Current User: just use Auth to get all the information available for the current user. https://aws-amplify.github.io/amplify-js/api/classes/authclass.html
Any cognito user: I think still need to build something yourself for that matter. You could create a lambda function and use the admin queries in that function to filter out "public" information about users or what so ever. https://docs.amplify.aws/cli/auth/admin/#admin-queries-api
You can also build lambda triggers for cognito if that already helps you. https://docs.amplify.aws/cli/usage/lambda-triggers/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Arturo |
| Solution 2 | priestor |
