Monday, 30 August 2021

Amplify Federated Sign In not returning Email for Facebook

I'm using AWS Amplify to add social signing. With google I'm getting the email of the user but it's missing in facebook.

This is my code:

  federatedSignIn(provider: any): void {
    switch (provider) {
      case 'facebook':
          console.log("Authenticating using Facebook");
          Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Facebook });
          break;
      case 'google':
        console.log("Authenticating using Google");
        Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Google });
        break;
    }
     
  }

This is what the "Pre sign-up" Lambda sees as an event.

{
    "version": "1",
    "region": "us-east-1",
    "userPoolId": "us-east-xxxxxx",
    "userName": "Facebook_123456",
    "callerContext": {
        "awsSdkVersion": "aws-sdk-unknown-unknown",
        "clientId": "123456abcd"
    },
    "triggerSource": "PreSignUp_ExternalProvider",
    "request": {
        "userAttributes": {
            "email_verified": "false",
            "cognito:email_alias": "",
            "phone_number_verified": "false",
            "cognito:phone_number_alias": ""
        },
        "validationData": {}
    },
    "response": {
        "autoConfirmUser": false,
        "autoVerifyEmail": false,
        "autoVerifyPhone": false
    }
}

Userpool settings enter image description here

enter image description here

Attribute mapping enter image description here



from Amplify Federated Sign In not returning Email for Facebook

No comments:

Post a Comment