Quickstart-android: Auth can't read email address in facebook

Created on 13 Sep 2016  路  4Comments  路  Source: firebase/quickstart-android

  • Android device: Nexus5
  • Android OS version: 6.0
  • Google Play Services version: 9.2.56
  • Firebase/Play Services SDK version: 9.0.2

Hi, I'm using signin with facebook auth.
I want to get email address through facebook token.
I followed your code, readPermissions("email", "public_profile");
I can get uid, diplayName and photo_url using facebook token, but can't get emaill address.
It returned just null.
I've used providerData and just user for email.

((UserInfo)getUser().getProviderData()).getEmail();
getUser().getEmail();

Is there way to get email with facebook token?
Thanks

Most helpful comment

Some facebook accounts don't have an email address attached to them (They have been activated by phone verification). Are you sure the facebook user you are reading has an email address to begin with?

All 4 comments

Some facebook accounts don't have an email address attached to them (They have been activated by phone verification). Are you sure the facebook user you are reading has an email address to begin with?

@fisache it's been a few months and the last thing in this thread was a reasonable solution by @myflashlab. I'm going to close this issue for lack of activity, hope you got everything resolved! If not, please comment.

this issue is still around in 11.4.0 sdk, my facebook user has email attached to it. Using

firebaseUser.getEmail() gives the current email set as identifier, but using provider data to get the email address of other providers still returns null.

for (UserInfo userInfo : firebaseUser.getProviderData()) {
            Log.i(userInfo.getUid(),userInfo.getProviderId()+" "+
                     userInfo.getEmail()+" "+userInfo.isEmailVerified() );
        }

and I'm saying this for the the providers who are absolutely returning the email addresses when they are linked to the account.
Please let me know if there is any solution to the null email in providerData

I also did the same. I used updateUI(currentUSer) after that I got the email from Authentication.CurrentUser.getEmail(). It worked without issues.

Was this page helpful?
0 / 5 - 0 ratings