File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ export interface AuthSettings {
242
242
appVerificationDisabledForTesting: boolean;
243
243
}
244
244
245
+ // @public
246
+ export function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
247
+
245
248
// @public
246
249
export const browserLocalPersistence: Persistence;
247
250
Original file line number Diff line number Diff line change @@ -83,6 +83,26 @@ export function onIdTokenChanged(
83
83
completed
84
84
);
85
85
}
86
+ /**
87
+ * Adds a blocking callback that runs before an auth state change
88
+ * sets a new user.
89
+ *
90
+ * @param auth - The {@link Auth} instance.
91
+ * @param callback - callback triggered before new user value is set.
92
+ * If this throws, it will block the user from being set.
93
+ * @param onAbort - callback triggered if a later before state changed
94
+ * callback throws, allowing you to undo any side effects.
95
+ */
96
+ export function beforeAuthStateChanged(
97
+ auth: Auth,
98
+ callback: (user: User|null) => void | Promise<void>,
99
+ onAbort?: () => void,
100
+ ): Unsubscribe {
101
+ return getModularInstance(auth).beforeAuthStateChanged(
102
+ callback,
103
+ onAbort
104
+ );
105
+ }
86
106
/**
87
107
* Adds an observer for changes to the user's sign-in state.
88
108
*
You can’t perform that action at this time.
0 commit comments