Hello,
I'm facing an issue where for some existing users in the Authentication panel, the following method (node admin) : admin.auth().verifyIdToken return a verified token with no email.
To be clear, some users are normal, and an email is returned.
But for some other I'm getting a decodedToken like this:
var decodedToken = {
iss: 'https://securetoken.google.com/firebase-project-id',
aud: 'firebase-project-id',
auth_time: 1234567890,
user_id: 'userDatabaseID',
sub: 'userDatabaseID',
iat: 1234567890,
exp: 1234567980,
email: '',
email_verified: false,
firebase: {
identities: {
'google.com': [ 'user ID for google provider' ],
email: [ '' ]
},
sign_in_provider: 'google.com'
},
uid: 'userDatabaseID'
};
I've investigated a little as it's somewhat a big issue, and found that using the client side library, the same user doesn't have an email in app.auth().currentUser.email but it has an email in app.auth().currentUser.providerData[0].email
So client side, i'm getting away with this.
Another finding was when I tried the admin.auth().getUser() method (on node admin).
It returned (for the same problem user) these kind of info:
var UserRecord = {
uidInternal: 'userDatabaseID',
emailInternal: '',
emailVerifiedInternal: false,
displayNameInternal: undefined,
photoURLInternal: undefined,
disabledInternal: false,
metadataInternal: {
createdAtInternal: 'some valid date',
lastSignedInAtInternal: 'some valid date'
},
providerDataInternal: [
{
uidInternal: 'user ID for google provider',
displayNameInternal: 'User Name',
emailInternal: 'user...@domain.com',
photoURLInternal: 'https://lh4.googleusercontent.com/alotofrandomchars/photo.jpg',
providerIdInternal: 'google.com'
}
]
};
Here we find an email in providerDataInternal[0].emailInternal
So I may also get away admin server.
But it seems like there are issues with current implementation: the email for such a user doesn't get updated when he logs-in.
One of those problem users is an account of mine, so I did some tests.
Any idea on how to get back to a clean situation with a healthy user database ?