voluptasmollitia
Version:
Monorepo for the Firebase JavaScript SDK
32 lines (19 loc) • 1.03 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@firebase/auth](./auth.md) > [onAuthStateChanged](./auth.onauthstatechanged.md)
## onAuthStateChanged() function
Adds an observer for changes to the user's sign-in state.
<b>Signature:</b>
```typescript
export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| auth | [Auth](./auth.auth.md) | The Auth instance. |
| nextOrObserver | [NextOrObserver](./auth.nextorobserver.md)<!-- --><[User](./auth.user.md)<!-- -->> | callback triggered on change. |
| error | ErrorFn | callback triggered on error. |
| completed | CompleteFn | callback triggered when observer is removed. |
<b>Returns:</b>
Unsubscribe
## Remarks
To keep the old behavior, see [onIdTokenChanged()](./auth.onidtokenchanged.md)<!-- -->.