Firebase Firestore Not Updating Email Verification Status

Firebase firestore not updating email verification status

It turns out that the token has to be refreshed as mentioned in the update above.

Here is how I solved my issue.

First I refresh the auth token

Auth.auth().currentUser?.getIDTokenForcingRefresh(true)

If that was successful, I then refresh the user.

Auth.auth().currentUser?.reload()

My issue was that I thought that reloading the user will refresh the token, I didn't imagine that things could be out of sync.

When I checked if the email was verified I got true but the firestore database needs a refreshed token for it to know that the email was verified.

Verify email changes not reflected on same session in Firestore


await this.afAuth.auth.currentUser.reload();

before you try and access the account again

Firebase email verification not working as expected, without verification the user is able to login

you need to check on the firebase databasae for the field that says "is email verified" and then if that BOOL value is TRUE, then let them in the app. the bool value will turn to TRUE automatically after they click the link in their email. so instead of doing it like your'e doing, query the user table for that user and check the boolean value for whether they are verified, if they are not, then don't let them in. good luck and have a fabulous day

Firebase: do not create users until email is verified

One solution is to use Email Link authentication: the account will be created when the user completes the process.

Paul Ruiz (Firebaser) has written a complete article detailing how to implement this option: See the "Email Link (Passwordless Sign-In)" section.

FYI, the equivalent doc for the iOS and Android SDKs can be find here and here.



Related Topics



Leave a reply



Submit