The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/auth > updateCurrentUser

updateCurrentUser() function

Asynchronously sets the provided user as Auth.currentUser on the Auth instance.

Signature:

export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;

Parameters

Parameter Type Description
auth Auth The Auth instance.
user User | null The new User.

Returns:

Promise<void>

Description

A new instance copy of the user provided will be made and set as currentUser.

This will trigger onAuthStateChanged() and onIdTokenChanged() listeners like other sign in methods.

The operation fails with an error if the user to be updated belongs to a different Firebase project.