Cannot Retrieve Email From Firebaseauthentication On Android/ios
Solution 1:
When using "multiple accounts per email" setting, the top level email user.getEmail()
is null for non-email (email/password or email link) accounts. You can get the email from the user.getProviderData().get(0).getEmail()
list, provided the provider is stored in index 0.
This is because the top level email is unique and no 2 accounts can share that. As a result, the top level email is null for any additional OAuth account created like Facebook, Google, etc with that email.
Solution 2:
@Billda
But we can get the email from the task.isSuccessful()
method.
Just use this snippet in on success task from the firebase:
Mapprofile= task.getResult().getAdditionalUserInfo().getProfile();
Object email = profile.get("email");
Obtaining the email from the use though we use the same email form Facebook and Google log in accounts.
By this way, you can get the email of the particular user
Thank you. Can you clearly post the problem where you are encountering it?
Because there are many possibilities where we can get the email as null.
Post a Comment for "Cannot Retrieve Email From Firebaseauthentication On Android/ios"