How do I listen for anonymous account changes? I have noticed, that the onAuthStateChanged
won't change if I "upgrade" the user from server side.
// server side "upgrade"
const authUser = await updateUser(uid, {
email, emailVerified: true, password, displayName: `${firstName} ${lastName}`, disabled: false
});
(...)
return await auth.createCustomToken(uid),
My checkout flow:
My problem is that if the user confirms his account, it will most likely happen in a new tab or on another device and leaves the old tab in an outdated state. I'd like to update that tab as well with a welcome message.
There is no listener that applies to account changes in Firebase Auth. You will need another way to somehow signal to the app that something has changed. Two options are:
In either case, you will need to manually force a reload of the current user by calling reload() on the current User object.