-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access federated user's attribute from user pool #3959
Comments
@haverchuck Piggybacking on this to point out that the amazon-cognito-auth-js package appears to be no longer supported ( amazon-archives/amazon-cognito-auth-js#214 ) by AWS. When people ask questions about that package, they are redirected to the Amplify team, but the Amplify team has left this question unanswered for 2+ months. Being that Amplify is built on top of that package, what is the path forward? Auth + user management is arguably the most important part of any app and it is disappointing to see AWS let the main sdk for a core & critical service go for 9+ months without resolving issues -- without announcement. |
@codeinaire @ajhool Amplify uses amazon-cognito-identity-js for most functionality related to User Pools. If you don't want to use Amplify, you can still use the amazon-cognito-identity-js sdk for most uses cases with some extra leg work. To get the user data, try starting with something like this:
|
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
** Which Category is your question related to? **
amazon-cognito-identity-js
** What AWS Services are you utilizing? **
AWS Cognito (user pools only), AWS API Gateway, and AWS Lambda.
** Provide additional details e.g. code snippets **
BACKGROUND
I'm using the above mentioned package to create an auth flow only using user pools. I'm using user pools as a user management system AND a way to federate through third party identity providers. I want to do this b/c a user pool will map a third party provider's details to itself once the user has signed-in through the third party.
I've created a custom sign-in button with help from the suggestions from this issue. I'm successfully able to log in with a third party provider, receive the
idToken
, and invoke the API Gateway with theidToken
. This is great and exactly what I want to do.ISSUE/SQUESTIONS
1. How am I able to access a federated user's attributes from the user pool in which they have been mapped?
I'm able to get a non-federated user's attributes using the
getCurrentUser()
method. It looks like this is b/c it retrieves a bunch of useful information from local storage put in there by theauthenticateUser()
method.But I haven't been able to figure out how to get a federated user's attributes from the user pool. I signed in with my federated user and tried to use the
authenticateUser()
method, but I just got a null value. I didn't store the two access keys I got from the federated signin into my local storage.2. Do I need to store the tokens I got from the federate sign-in into local store and then call
getCurrentUser()
?In this issue @powerful23 suggested a way to parse the response from a federated sign in, however, it uses the
amazon-cognito-auth-js
. It is my understanding thatamazon-cognito-identity-js
is the library to use for more customised auth flow.3. Do I have to use the
amazon-cognito-auth-js
library to achieve this? Or can I used theamazon-cognito-identity-js
library?One last question regarding the functionality of mapping federated user's attributes to the user pool.
4. If I cannot access a federated user's attributes why are they even mapped to the user pool??
Thanks in advanced for any help!
The text was updated successfully, but these errors were encountered: