2
votes

I have a situation where after the login redirect from a provider, the same code tells me the currentUser is null, even though I'm seeing data in the network console. On top of it if I refresh it is good. But after the redirect, the user is still null.

I tried on auth().onAuthStateChanged but that doesn't work.

Thanks for your insight.

1

1 Answers

0
votes

It's not auth but auth(), this should work:

firebase.auth().onAuthStateChanged(user => {
    if(user) {
        console.log(user.uid);
    }
});