TransWikia.com

Verify email changes not reflected on same session in Firestore

Stack Overflow Asked by Tapas Mukherjee on February 6, 2021

In my Ionic 5 app with Firestore, I am trying to stop user from accessing the app before the email address is verified. This is done by a page when user is given a ‘Continue’ button to click after the email verification is done.

Following is code checking whether the email is verified by user.

this.afAuth.auth.currentUser.emailVerified

This always returns false if I’m not closing the app and on the same session but it returns true if I restart the app.

I don’t want to ask my users to restart the app as that is a bad user experience. Is there a way I can fix this or refresh the auth change so that the following subscription in the app.component.ts executes again.

this.afAuth.authState.subscribe(user=>{
//retrigger this
}) 

One Answer

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

before you try and access the account again

Answered by Aaron Saunders on February 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP