You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Retrieve and monitor the authentication state from Firebase.
39
+
Retrieve and monitor the authentication state from Firebase. Uses `auth.onAuthStateChanged` so is only triggered when a user signs in or signs out. See [useIdToken](#useidtoken) if you need to monitor token changes too.
39
40
40
41
The `useAuthState` hook takes the following parameters:
Retrieve and monitor changes to the ID token from Firebase. Uses `auth.onIdTokenChanged` so includes when a user signs in, signs out or token refresh events.
106
+
107
+
The `useIdToken` hook takes the following parameters:
108
+
109
+
-`auth`: `auth.Auth` instance for the app you would like to monitor
110
+
-`options`: (optional) `Object with the following parameters:
111
+
-`onUserChanged`: (optional) function to be called with `auth.User` each time the user changes. This allows you to do things like load custom claims.
112
+
113
+
Returns:
114
+
115
+
-`user`: The `auth.UserCredential` if logged in, or `null` if not
116
+
-`loading`: A `boolean` to indicate whether the authentication state is still being loaded
117
+
-`error`: Any `AuthError` returned by Firebase when trying to load the user, or `undefined` if there is no error
118
+
119
+
#### If you are registering or signing in the user for the first time consider using [useCreateUserWithEmailAndPassword](#usecreateuserwithemailandpassword), [useSignInWithEmailAndPassword](#usesigninwithemailandpassword)
0 commit comments