0

I need to get the latest user data like - emailVerified, displayName, and profilePhoto. User is already logged-in. I want some sort of event or may be a call to server to see, latest value of user profile data.

firebase.auth().currentUser.emailVerified

I was trying this, but its returning the value from local (cached values at login), not the latest value from server. One question is already there, but not answered. :(

how to get the latest firebase user authentication data from server?

Deepak Sharma
  • 4,124
  • 1
  • 14
  • 31

1 Answers1

0

You need to call the reload() method, which is asynchronous and returns a Promise.

firebase.auth().currentUser.reload()
.then(() => {
        if (firebase.auth().currentUser.emailVerified) {
            //...
        } else {
            //...
        }
});
Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
  • thanks, I tried to find the duplicate questions also. but couldn't. Thanks for tagging, and answering it. – Deepak Sharma Dec 22 '20 at 17:47
  • hey need help here --> https://stackoverflow.com/questions/65424508/push-notification-enable-and-disable-by-using-switch – IRON MAN Dec 23 '20 at 12:59