voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
33 lines (18 loc) • 1.08 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [Auth](./auth.auth.md) > [updateCurrentUser](./auth.auth.updatecurrentuser.md)
## Auth.updateCurrentUser() method
Asynchronously sets the provided user as [Auth.currentUser](./auth.auth.currentuser.md) on the [Auth](./auth.auth.md) instance.
<b>Signature:</b>
```typescript
updateCurrentUser(user: User | null): Promise<void>;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| 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 [Auth.onAuthStateChanged()](./auth.auth.onauthstatechanged.md) and [Auth.onIdTokenChanged()](./auth.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.