Reputation: 955
Firebase provides 2 advanced option in their dashboard to manage duplicate authentication:
First, Multiple accounts per email address Second, One account per email address
Auth with "One account per email address" is working as expected but when I try "Multiple accounts per email address", the Auth callback doesn't return email address of the user (i.e. null) nor the emailVerified field is true.
What may be the possible reason? Is this glitch voluntarily implemented by Firebase.
Upvotes: 2
Views: 3657
Reputation: 30798
This is by design, the top level email currentUser.email
has to be unique. In that mode "multiple accounts per email", you can have multiple accounts with that email, so this is not set in this mode (except for password accounts) as the user identifier would clash. You can always set that via currentUser.updateEmail' API but the Auth backend will enforce the uniqueness. You can access the provider email via the providerData on the user
currentUser.providerData[0].email`. If you are using Google as a provider and don't get the Google email in the web signInWithPopup/Redirect flow, make sure you ask the 'email' OAuth scope.
Upvotes: 2