Search code examples
oauth-2.0facebook-loginamazon-cognito

Login with Facebook using Cognito is redirecting to URL with an error


I've created a User Poll and connected a Facebook to it. Here is what it looks like in the AWS Console.

CognitoFacebook

I also have set email as a required attribute for signing up.

However, when I visit my hosted login page and click Continue with Facebook, I get redirected back to my page with URL

http://localhost:4200/#error_description=attributes%20required:%20[email]&error=invalid_request

Why is this happening? I've followed all the instructions, and have included email as a scope. I am expecting an access_token in the URL.

Please help. Thanks!


Solution

  • The error message says that the email address is required which indicates that email is a required attribute on your user pool. You have done the correct thing by including the "email" scope but you also have to include the attribute mapping for the provider (Facebook in your case) in the Amazon Cognito console by mapping facebook email to Cognito email attribute. Please give this a shot and let us know if it worked or not.