voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
34 lines (19 loc) • 1.12 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [updateCurrentUser](./auth.updatecurrentuser.md)
## updateCurrentUser() function
Asynchronously sets the provided user as [Auth.currentUser](./auth.auth.currentuser.md) on the [Auth](./auth.auth.md) instance.
<b>Signature:</b>
```typescript
export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| auth | [Auth](./auth.auth.md) | The Auth instance. |
| user | [User](./auth.user.md) \| null | The new [User](./auth.user.md)<!-- -->. |
<b>Returns:</b>
Promise<void>
## Remarks
A new instance copy of the user provided will be made and set as currentUser.
This will trigger [onAuthStateChanged()](./auth.onauthstatechanged.md) and [onIdTokenChanged()](./auth.onidtokenchanged.md) listeners like other sign in methods.
The operation fails with an error if the user to be updated belongs to a different Firebase project.