I have following flow for my sign up process:
User fills out details and signs up (gets send verification email)
After this user is logged in, but sees a screen asking to for email verification
User verifies their email and goes back to app
At this stage how can I get new user data that will have emailVerified
field without logging user out?
I expected auth().onAuthStateChanged
to be fired once emailVerified
changes to true, but that does not happen, nor can I find any refresh function in firebase docs to get this data manually.
Only way I can get that new value for emailVerified
is by loging out and loging back in, but ideally would like to avoid this.
update: this is using JavaScript SDK
I have following flow for my sign up process:
User fills out details and signs up (gets send verification email)
After this user is logged in, but sees a screen asking to for email verification
User verifies their email and goes back to app
At this stage how can I get new user data that will have emailVerified
field without logging user out?
I expected auth().onAuthStateChanged
to be fired once emailVerified
changes to true, but that does not happen, nor can I find any refresh function in firebase docs to get this data manually.
Only way I can get that new value for emailVerified
is by loging out and loging back in, but ideally would like to avoid this.
update: this is using JavaScript SDK
Share Improve this question edited Jan 26, 2017 at 14:02 Sara Fuerst 6,1189 gold badges49 silver badges94 bronze badges asked Jan 26, 2017 at 13:46 IljaIlja 46.6k103 gold badges289 silver badges528 bronze badges 7- There is a known issue in version 9.8-10.0 of the Firebase SDK for Android that means it only updates the user profile when you sign in. Until that is fixed (I don't know when the release is out), there is no solution. Workarounds: stick to 9.6 or to sign-out/sign-in. – Frank van Puffelen Commented Jan 26, 2017 at 13:52
- See stackoverflow./questions/40723639/… and stackoverflow./questions/41651454/update-to-authdata/… – Frank van Puffelen Commented Jan 26, 2017 at 13:53
- @FrankvanPuffelenoh my bad, I updated the question this is for latest (3.6.7) javascript sdk – Ilja Commented Jan 26, 2017 at 13:54
-
1
currentUser.getToken(true)
makes onAuthStateChanged fire but returned user object still doesn't have updated emailVerified field – Ilja Commented Jan 26, 2017 at 14:07 - 1 @llja Did you figure this out? – Jasmeet Commented Nov 19, 2019 at 16:20
1 Answer
Reset to default 8Based on android I did
firebase.auth().currentUser.reload().then(() => {
console.log(firebase.auth().currentUser)
})
this returns updated information about the user, I couldn't find this anywhere in the docs for some reason