Home > database >  Does each firebase user automatically have an email address, no matter what sign-in-method is used?
Does each firebase user automatically have an email address, no matter what sign-in-method is used?

Time:07-05

Obviously, if you sign in anonymously, you have no email address, and if you sign in with email, you have one.

But what if I sign in with Google, Apple, Facebook, etc... Will each firebase user just get the email address, which is assigned to the Google, Apple... account? Or is there a possibility that some users will have null as their email address?

I want to know this, because I want to have a list of users in my app (admins more specifically, so not a very large list), but I don't want to use their uid to display in a list. I want to use something more readable to a human, like their email address (or their displayName).

CodePudding user response:

While Firebase Authentication uses the email address as a primary identifier for the user, it is possible for a user to not have an email address - for example when the OAuth provider doesn't provide this information.

If you want to display a meaningful value for each user, I'd recommend combining the email address and display name for the best chance of having something recognizable.

  • Related