Home > @firebase/auth > Auth > onAuthStateChanged
Auth.onAuthStateChanged() method
Adds an observer for changes to the user's sign-in state.
Signature:
onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
Parameters
Parameter | Type | Description |
---|---|---|
nextOrObserver | NextOrObserver<User | null> | callback triggered on change. |
error | ErrorFn | callback triggered on error. |
completed | CompleteFn | callback triggered when observer is removed. |
Returns:
Unsubscribe
Description
To keep the old behavior, see Auth.onIdTokenChanged().