Ad

Update The Email Verification Status Without Reloading Page

After registering in my web app, i redirect the user to a page, where he is told to verify his email. Once he has done that, i want to automatically detect the change of the verificationStatus and then change the page. Something along those lines.

auth.user.subscribe(user => {
  if (!!user && user.emailVerified === true) {
    this.redirectToLogin();
  }
});

I couldn't find any way to detect changes of the emailVerified status, so I thought, maybe have an interval runnning that is updating the user data every now and then, but I couldn't find a way how to refresh the user data from firebase authentication.

Is there a way to update the user data without reloading/refreshing the page? Do i have to refresh the authState? If possible, how can i do that?

Is what I want to do, even possible?

Ad

Answer

The change in email verification status happens on the Firebase servers. It is not automatically pushed to the client.

On the client you can reload the user data to pick up any changes, by calling User.reload().

Also see:

Ad
source: stackoverflow.com
Ad