Search code examples
androidamazon-cognitofederated-identityamazon-cognito-facebook

Cognito: Get federated identity email


When using cognito, (not just user pool, but Google and FB federated identites too) how can I get the users email address?

Do I have to make a separate call to the federated identity provider? If so could you provide an example that won't prompt the user again?


Solution

  • Retrieving email address for users in UserPool:

    • Id Token returned after user authentication contains email claim.

    You can also call following API operations to retrieve email address and other user attributes.

    Retrieving email address for identityId in Cognito Federated Identities:

    If you are using developer authenticated identities you can use developer user identifier as email address and then use LookupDeveloperIdentity to get email address from identityId and vice versa.

    There is currently no system supported way to get user's email address or other attributes from Google, Facebook and other OIDC providers federated identities but you can leverage Cognito Sync to store/retrieve user profile information yourself including email address.