(1) Question:
Is there a way to read user email having the uid? (permitted only for super user or server)
Ps.: I don't want to save in the Realtime database, because even though only the current user can change it, he can erase or put some fake email..
(2) Problem:
I'm trying to retrieve user email with GoogleAuthProvider in Firebase v3
Thats the code I'm using:
signInWithGoogle(): Promise<any> {
let provider = new firebase.auth.GoogleAuthProvider();
provider.addScope("https://www.googleapis.com/auth/userinfo.email");
return firebase.auth().signInWithPopup(provider)
.then((result) => {
console.log(result.user.email);
console.log(result.credential);
let token = result.credential.accessToken;
return this.createOrUpdateUser(result.user, token);
});
}
The result:
result.user.email # null
result.user.providerData[0].email # correct_email@gmail.com
Even though the email is in the providerData, it is not attached to the auth..
Is it a firebase bug or can I fix it somehow?
Thanks!