@firebase/auth-compat 0.5.15-canary.a97ac88db → 0.5.15-canary.e577a408c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/auth-compat/index.d.ts +1119 -102
  2. package/dist/auth-compat/index.node.d.ts +24 -24
  3. package/dist/auth-compat/scripts/run_node_tests.d.ts +17 -17
  4. package/dist/auth-compat/src/auth.d.ts +72 -72
  5. package/dist/auth-compat/src/auth.test.d.ts +17 -17
  6. package/dist/auth-compat/src/persistence.d.ts +29 -29
  7. package/dist/auth-compat/src/phone_auth_provider.d.ts +29 -29
  8. package/dist/auth-compat/src/platform.d.ts +39 -39
  9. package/dist/auth-compat/src/popup_redirect.d.ts +34 -34
  10. package/dist/auth-compat/src/popup_redirect.test.d.ts +17 -17
  11. package/dist/auth-compat/src/recaptcha_verifier.d.ts +28 -28
  12. package/dist/auth-compat/src/user.d.ts +64 -64
  13. package/dist/auth-compat/src/user_credential.d.ts +20 -20
  14. package/dist/auth-compat/src/wrap.d.ts +26 -26
  15. package/dist/auth-compat/test/helpers/helpers.d.ts +24 -24
  16. package/dist/auth-compat/test/integration/flows/anonymous.test.d.ts +17 -17
  17. package/dist/auth-compat/test/integration/flows/custom.test.d.ts +17 -17
  18. package/dist/auth-compat/test/integration/flows/email.test.d.ts +17 -17
  19. package/dist/auth-compat/test/integration/flows/idp.test.d.ts +17 -17
  20. package/dist/auth-compat/test/integration/flows/oob.test.d.ts +17 -17
  21. package/dist/auth-compat/test/integration/flows/phone.test.d.ts +17 -17
  22. package/dist/esm/auth-compat/index.d.ts +50 -50
  23. package/dist/esm/auth-compat/index.node.d.ts +24 -24
  24. package/dist/esm/auth-compat/scripts/run_node_tests.d.ts +17 -17
  25. package/dist/esm/auth-compat/src/auth.d.ts +72 -72
  26. package/dist/esm/auth-compat/src/auth.test.d.ts +17 -17
  27. package/dist/esm/auth-compat/src/persistence.d.ts +29 -29
  28. package/dist/esm/auth-compat/src/phone_auth_provider.d.ts +29 -29
  29. package/dist/esm/auth-compat/src/platform.d.ts +39 -39
  30. package/dist/esm/auth-compat/src/popup_redirect.d.ts +34 -34
  31. package/dist/esm/auth-compat/src/popup_redirect.test.d.ts +17 -17
  32. package/dist/esm/auth-compat/src/recaptcha_verifier.d.ts +28 -28
  33. package/dist/esm/auth-compat/src/user.d.ts +64 -64
  34. package/dist/esm/auth-compat/src/user_credential.d.ts +20 -20
  35. package/dist/esm/auth-compat/src/wrap.d.ts +26 -26
  36. package/dist/esm/auth-compat/test/helpers/helpers.d.ts +24 -24
  37. package/dist/esm/auth-compat/test/integration/flows/anonymous.test.d.ts +17 -17
  38. package/dist/esm/auth-compat/test/integration/flows/custom.test.d.ts +17 -17
  39. package/dist/esm/auth-compat/test/integration/flows/email.test.d.ts +17 -17
  40. package/dist/esm/auth-compat/test/integration/flows/idp.test.d.ts +17 -17
  41. package/dist/esm/auth-compat/test/integration/flows/oob.test.d.ts +17 -17
  42. package/dist/esm/auth-compat/test/integration/flows/phone.test.d.ts +17 -17
  43. package/dist/esm/index.node.esm.js +993 -993
  44. package/dist/esm/index.node.esm.js.map +1 -1
  45. package/dist/firebase-auth.js +1 -1
  46. package/dist/firebase-auth.js.map +1 -1
  47. package/dist/index.cjs.js +977 -977
  48. package/dist/index.cjs.js.map +1 -1
  49. package/dist/index.esm2017.js +977 -977
  50. package/dist/index.esm2017.js.map +1 -1
  51. package/dist/index.node.cjs.js +993 -993
  52. package/dist/index.node.cjs.js.map +1 -1
  53. package/package.json +8 -8
@@ -1,112 +1,1129 @@
1
- /**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- import * as types from '@firebase/auth-types';
18
- declare module '@firebase/component' {
19
- interface NameServiceMapping {
20
- 'auth-compat': types.FirebaseAuth;
21
- }
22
- }
23
- declare module '@firebase/app-compat' {
24
- interface FirebaseNamespace {
25
- auth: {
26
- (app?: FirebaseApp): types.FirebaseAuth;
27
- Auth: typeof types.FirebaseAuth;
28
- EmailAuthProvider: typeof types.EmailAuthProvider;
29
- EmailAuthProvider_Instance: typeof types.EmailAuthProvider_Instance;
30
- FacebookAuthProvider: typeof types.FacebookAuthProvider;
31
- FacebookAuthProvider_Instance: typeof types.FacebookAuthProvider_Instance;
32
- GithubAuthProvider: typeof types.GithubAuthProvider;
33
- GithubAuthProvider_Instance: typeof types.GithubAuthProvider_Instance;
34
- GoogleAuthProvider: typeof types.GoogleAuthProvider;
35
- GoogleAuthProvider_Instance: typeof types.GoogleAuthProvider_Instance;
36
- OAuthProvider: typeof types.OAuthProvider;
37
- SAMLAuthProvider: typeof types.SAMLAuthProvider;
38
- PhoneAuthProvider: typeof types.PhoneAuthProvider;
39
- PhoneAuthProvider_Instance: typeof types.PhoneAuthProvider_Instance;
40
- PhoneMultiFactorGenerator: typeof types.PhoneMultiFactorGenerator;
41
- RecaptchaVerifier: typeof types.RecaptchaVerifier;
42
- RecaptchaVerifier_Instance: typeof types.RecaptchaVerifier_Instance;
43
- TwitterAuthProvider: typeof types.TwitterAuthProvider;
44
- TwitterAuthProvider_Instance: typeof types.TwitterAuthProvider_Instance;
45
- };
46
- }
47
- interface FirebaseApp {
48
- auth?(): types.FirebaseAuth;
49
- }
50
- }
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import * as types from '@firebase/auth-types';
18
+ declare module '@firebase/component' {
19
+ interface NameServiceMapping {
20
+ 'auth-compat': types.FirebaseAuth;
21
+ }
22
+ }
23
+ declare module '@firebase/app-compat' {
24
+ interface FirebaseNamespace {
25
+ auth: {
26
+ (app?: FirebaseApp): types.FirebaseAuth;
27
+ Auth: typeof types.FirebaseAuth;
28
+ EmailAuthProvider: typeof types.EmailAuthProvider;
29
+ EmailAuthProvider_Instance: typeof types.EmailAuthProvider_Instance;
30
+ FacebookAuthProvider: typeof types.FacebookAuthProvider;
31
+ FacebookAuthProvider_Instance: typeof types.FacebookAuthProvider_Instance;
32
+ GithubAuthProvider: typeof types.GithubAuthProvider;
33
+ GithubAuthProvider_Instance: typeof types.GithubAuthProvider_Instance;
34
+ GoogleAuthProvider: typeof types.GoogleAuthProvider;
35
+ GoogleAuthProvider_Instance: typeof types.GoogleAuthProvider_Instance;
36
+ OAuthProvider: typeof types.OAuthProvider;
37
+ SAMLAuthProvider: typeof types.SAMLAuthProvider;
38
+ PhoneAuthProvider: typeof types.PhoneAuthProvider;
39
+ PhoneAuthProvider_Instance: typeof types.PhoneAuthProvider_Instance;
40
+ PhoneMultiFactorGenerator: typeof types.PhoneMultiFactorGenerator;
41
+ RecaptchaVerifier: typeof types.RecaptchaVerifier;
42
+ RecaptchaVerifier_Instance: typeof types.RecaptchaVerifier_Instance;
43
+ TwitterAuthProvider: typeof types.TwitterAuthProvider;
44
+ TwitterAuthProvider_Instance: typeof types.TwitterAuthProvider_Instance;
45
+ };
46
+ }
47
+ interface FirebaseApp {
48
+ auth?(): types.FirebaseAuth;
49
+ }
50
+ }
51
51
 
52
52
  import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat";
53
53
  import { type User, type Unsubscribe, type ActionCodeInfo, type UserCredential, type Auth, type IdTokenResult, type MultiFactorError, type MultiFactorResolver, type PopupRedirectResolver, type Dependencies, type AuthCredential, type ApplicationVerifier, type ConfirmationResult, type AuthProvider, type MultiFactorUser, type NextOrObserver, type ErrorFn, type CompleteFn, type ActionCodeSettings, type Persistence, type PhoneAuthCredential, type PasswordValidationStatus } from "@firebase/auth";
54
54
  declare module "@firebase/auth" {
55
- function applyActionCode(auth: types.FirebaseAuth, oobCode: string): Promise<void>;
56
- function beforeAuthStateChanged(auth: types.FirebaseAuth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
57
- function checkActionCode(auth: types.FirebaseAuth, oobCode: string): Promise<ActionCodeInfo>;
58
- function confirmPasswordReset(auth: types.FirebaseAuth, oobCode: string, newPassword: string): Promise<void>;
59
- function connectAuthEmulator(auth: types.FirebaseAuth, url: string, options?: {
55
+ /**
56
+ * Applies a verification code sent to the user by email or other out-of-band mechanism.
57
+ *
58
+ * @param auth - The {@link Auth} instance.
59
+ * @param oobCode - A verification code sent to the user.
60
+ *
61
+ * @public
62
+ */
63
+ export declare function applyActionCode(auth: types.FirebaseAuth, oobCode: string): Promise<void>;
64
+ /**
65
+ * Adds a blocking callback that runs before an auth state change
66
+ * sets a new user.
67
+ *
68
+ * @param auth - The {@link Auth} instance.
69
+ * @param callback - callback triggered before new user value is set.
70
+ * If this throws, it blocks the user from being set.
71
+ * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
72
+ * callback throws, allowing you to undo any side effects.
73
+ */
74
+ export declare function beforeAuthStateChanged(auth: types.FirebaseAuth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
75
+ /**
76
+ * Checks a verification code sent to the user by email or other out-of-band mechanism.
77
+ *
78
+ * @returns metadata about the code.
79
+ *
80
+ * @param auth - The {@link Auth} instance.
81
+ * @param oobCode - A verification code sent to the user.
82
+ *
83
+ * @public
84
+ */
85
+ export declare function checkActionCode(auth: types.FirebaseAuth, oobCode: string): Promise<ActionCodeInfo>;
86
+ /**
87
+ * Completes the password reset process, given a confirmation code and new password.
88
+ *
89
+ * @param auth - The {@link Auth} instance.
90
+ * @param oobCode - A confirmation code sent to the user.
91
+ * @param newPassword - The new password.
92
+ *
93
+ * @public
94
+ */
95
+ export declare function confirmPasswordReset(auth: types.FirebaseAuth, oobCode: string, newPassword: string): Promise<void>;
96
+ /**
97
+ * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
98
+ * Firebase Auth services.
99
+ *
100
+ * @remarks
101
+ * This must be called synchronously immediately following the first call to
102
+ * {@link initializeAuth}. Do not use with production credentials as emulator
103
+ * traffic is not encrypted.
104
+ *
105
+ *
106
+ * @example
107
+ * ```javascript
108
+ * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });
109
+ * ```
110
+ *
111
+ * @param auth - The {@link Auth} instance.
112
+ * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').
113
+ * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to
114
+ * `true` to disable the warning banner attached to the DOM.
115
+ *
116
+ * @public
117
+ */
118
+ export declare function connectAuthEmulator(auth: types.FirebaseAuth, url: string, options?: {
60
119
  disableWarnings: boolean;
61
120
  }): void;
62
- function createUserWithEmailAndPassword(auth: types.FirebaseAuth, email: string, password: string): Promise<UserCredential>;
63
- function deleteUser(user: types.User): Promise<void>;
64
- function fetchSignInMethodsForEmail(auth: types.FirebaseAuth, email: string): Promise<string[]>;
65
- function getAuth(app?: FirebaseAppCompat): Auth;
66
- function getIdToken(user: types.User, forceRefresh?: boolean): Promise<string>;
67
- function getIdTokenResult(user: types.User, forceRefresh?: boolean): Promise<IdTokenResult>;
68
- function getMultiFactorResolver(auth: types.FirebaseAuth, error: MultiFactorError): MultiFactorResolver;
69
- function getRedirectResult(auth: types.FirebaseAuth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>;
70
- function initializeAuth(app: FirebaseAppCompat, deps?: Dependencies): Auth;
71
- function initializeRecaptchaConfig(auth: types.FirebaseAuth): Promise<void>;
72
- function isSignInWithEmailLink(auth: types.FirebaseAuth, emailLink: string): boolean;
73
- function linkWithCredential(user: types.User, credential: AuthCredential): Promise<UserCredential>;
74
- function linkWithPhoneNumber(user: types.User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
75
- function linkWithPopup(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
76
- function linkWithRedirect(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
77
- function multiFactor(user: types.User): MultiFactorUser;
78
- function onAuthStateChanged(auth: types.FirebaseAuth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
79
- function onIdTokenChanged(auth: types.FirebaseAuth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
80
- function reauthenticateWithCredential(user: types.User, credential: AuthCredential): Promise<UserCredential>;
81
- function reauthenticateWithPhoneNumber(user: types.User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
82
- function reauthenticateWithPopup(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
83
- function reauthenticateWithRedirect(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
84
- function reload(user: types.User): Promise<void>;
85
- function revokeAccessToken(auth: types.FirebaseAuth, token: string): Promise<void>;
86
- function sendEmailVerification(user: types.User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
87
- function sendPasswordResetEmail(auth: types.FirebaseAuth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
88
- function sendSignInLinkToEmail(auth: types.FirebaseAuth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;
89
- function setPersistence(auth: types.FirebaseAuth, persistence: Persistence): Promise<void>;
90
- function signInAnonymously(auth: types.FirebaseAuth): Promise<UserCredential>;
91
- function signInWithCredential(auth: types.FirebaseAuth, credential: AuthCredential): Promise<UserCredential>;
92
- function signInWithCustomToken(auth: types.FirebaseAuth, customToken: string): Promise<UserCredential>;
93
- function signInWithEmailAndPassword(auth: types.FirebaseAuth, email: string, password: string): Promise<UserCredential>;
94
- function signInWithEmailLink(auth: types.FirebaseAuth, email: string, emailLink?: string): Promise<UserCredential>;
95
- function signInWithPhoneNumber(auth: types.FirebaseAuth, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
96
- function signInWithPopup(auth: types.FirebaseAuth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
97
- function signInWithRedirect(auth: types.FirebaseAuth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
98
- function signOut(auth: types.FirebaseAuth): Promise<void>;
99
- function unlink(user: types.User, providerId: string): Promise<User>;
100
- function updateCurrentUser(auth: types.FirebaseAuth, user: User | null): Promise<void>;
101
- function updateEmail(user: types.User, newEmail: string): Promise<void>;
102
- function updatePassword(user: types.User, newPassword: string): Promise<void>;
103
- function updatePhoneNumber(user: types.User, credential: PhoneAuthCredential): Promise<void>;
104
- function updateProfile(user: types.User, { displayName, photoURL: photoUrl }: {
121
+ /**
122
+ * Creates a new user account associated with the specified email address and password.
123
+ *
124
+ * @remarks
125
+ * On successful creation of the user account, this user will also be signed in to your application.
126
+ *
127
+ * User account creation can fail if the account already exists or the password is invalid.
128
+ *
129
+ * This method is not supported on {@link Auth} instances created with a
130
+ * {@link @firebase/app#FirebaseServerApp}.
131
+ *
132
+ * Note: The email address acts as a unique identifier for the user and enables an email-based
133
+ * password reset. This function will create a new user account and set the initial user password.
134
+ *
135
+ * @param auth - The {@link Auth} instance.
136
+ * @param email - The user's email address.
137
+ * @param password - The user's chosen password.
138
+ *
139
+ * @public
140
+ */
141
+ export declare function createUserWithEmailAndPassword(auth: types.FirebaseAuth, email: string, password: string): Promise<UserCredential>;
142
+ /**
143
+ * Deletes and signs out the user.
144
+ *
145
+ * @remarks
146
+ * Important: this is a security-sensitive operation that requires the user to have recently
147
+ * signed in. If this requirement isn't met, ask the user to authenticate again and then call
148
+ * {@link reauthenticateWithCredential}.
149
+ *
150
+ * @param user - The user.
151
+ *
152
+ * @public
153
+ */
154
+ export declare function deleteUser(user: types.User): Promise<void>;
155
+ /**
156
+ * Gets the list of possible sign in methods for the given email address. This method returns an
157
+ * empty list when
158
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
159
+ * is enabled, irrespective of the number of authentication methods available for the given email.
160
+ *
161
+ * @remarks
162
+ * This is useful to differentiate methods of sign-in for the same provider, eg.
163
+ * {@link EmailAuthProvider} which has 2 methods of sign-in,
164
+ * {@link SignInMethod}.EMAIL_PASSWORD and
165
+ * {@link SignInMethod}.EMAIL_LINK.
166
+ *
167
+ * @param auth - The {@link Auth} instance.
168
+ * @param email - The user's email address.
169
+ *
170
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
171
+ * Learn more in the Identity Platform documentation for
172
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}.
173
+ * @public
174
+ */
175
+ export declare function fetchSignInMethodsForEmail(auth: types.FirebaseAuth, email: string): Promise<string[]>;
176
+ /**
177
+ * Returns the Auth instance associated with the provided {@link @firebase/app#FirebaseApp}.
178
+ * If no instance exists, initializes an Auth instance with platform-specific default dependencies.
179
+ *
180
+ * @param app - The Firebase App.
181
+ *
182
+ * @public
183
+ */
184
+ export declare function getAuth(app?: FirebaseAppCompat): Auth;
185
+ /**
186
+ * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
187
+ *
188
+ * @remarks
189
+ * Returns the current token if it has not expired or if it will not expire in the next five
190
+ * minutes. Otherwise, this will refresh the token and return a new one.
191
+ *
192
+ * @param user - The user.
193
+ * @param forceRefresh - Force refresh regardless of token expiration.
194
+ *
195
+ * @public
196
+ */
197
+ export declare function getIdToken(user: types.User, forceRefresh?: boolean): Promise<string>;
198
+ /**
199
+ * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
200
+ *
201
+ * @remarks
202
+ * Returns the current token if it has not expired or if it will not expire in the next five
203
+ * minutes. Otherwise, this will refresh the token and return a new one.
204
+ *
205
+ * @param user - The user.
206
+ * @param forceRefresh - Force refresh regardless of token expiration.
207
+ *
208
+ * @public
209
+ */
210
+ export declare function getIdTokenResult(user: types.User, forceRefresh?: boolean): Promise<IdTokenResult>;
211
+ /**
212
+ * Provides a {@link MultiFactorResolver} suitable for completion of a
213
+ * multi-factor flow.
214
+ *
215
+ * @param auth - The {@link Auth} instance.
216
+ * @param error - The {@link MultiFactorError} raised during a sign-in, or
217
+ * reauthentication operation.
218
+ *
219
+ * @public
220
+ */
221
+ export declare function getMultiFactorResolver(auth: types.FirebaseAuth, error: MultiFactorError): MultiFactorResolver;
222
+ /**
223
+ * Returns a {@link UserCredential} from the redirect-based sign-in flow.
224
+ *
225
+ * @remarks
226
+ * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
227
+ * error. If no redirect operation was called, returns `null`.
228
+ *
229
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
230
+ * {@link @firebase/app#FirebaseServerApp}.
231
+ *
232
+ * @example
233
+ * ```javascript
234
+ * // Sign in using a redirect.
235
+ * const provider = new FacebookAuthProvider();
236
+ * // You can add additional scopes to the provider:
237
+ * provider.addScope('user_birthday');
238
+ * // Start a sign in process for an unauthenticated user.
239
+ * await signInWithRedirect(auth, provider);
240
+ * // This will trigger a full page redirect away from your app
241
+ *
242
+ * // After returning from the redirect when your app initializes you can obtain the result
243
+ * const result = await getRedirectResult(auth);
244
+ * if (result) {
245
+ * // This is the signed-in user
246
+ * const user = result.user;
247
+ * // This gives you a Facebook Access Token.
248
+ * const credential = provider.credentialFromResult(auth, result);
249
+ * const token = credential.accessToken;
250
+ * }
251
+ * // As this API can be used for sign-in, linking and reauthentication,
252
+ * // check the operationType to determine what triggered this redirect
253
+ * // operation.
254
+ * const operationType = result.operationType;
255
+ * ```
256
+ *
257
+ * @param auth - The {@link Auth} instance.
258
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
259
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
260
+ *
261
+ * @public
262
+ */
263
+ export declare function getRedirectResult(auth: types.FirebaseAuth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>;
264
+ /**
265
+ * Initializes an {@link Auth} instance with fine-grained control over
266
+ * {@link Dependencies}.
267
+ *
268
+ * @remarks
269
+ *
270
+ * This function allows more control over the {@link Auth} instance than
271
+ * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
272
+ * the {@link Dependencies}. In general, `getAuth` is the easiest way to
273
+ * initialize Auth and works for most use cases. Use `initializeAuth` if you
274
+ * need control over which persistence layer is used, or to minimize bundle
275
+ * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
276
+ *
277
+ * For example, if your app only uses anonymous accounts and you only want
278
+ * accounts saved for the current session, initialize `Auth` with:
279
+ *
280
+ * ```js
281
+ * const auth = initializeAuth(app, {
282
+ * persistence: browserSessionPersistence,
283
+ * popupRedirectResolver: undefined,
284
+ * });
285
+ * ```
286
+ *
287
+ * @public
288
+ */
289
+ export declare function initializeAuth(app: FirebaseAppCompat, deps?: Dependencies): Auth;
290
+ /**
291
+ * Loads the reCAPTCHA configuration into the `Auth` instance.
292
+ *
293
+ * @remarks
294
+ * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
295
+ * verification flow should be triggered for each auth provider, into the
296
+ * current Auth session.
297
+ *
298
+ * If initializeRecaptchaConfig() is not invoked, the auth flow will always start
299
+ * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
300
+ * verification, the SDK will transparently load the reCAPTCHA config and restart the
301
+ * auth flows.
302
+ *
303
+ * Thus, by calling this optional method, you will reduce the latency of future auth flows.
304
+ * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
305
+ *
306
+ * This method does not work in a Node.js environment.
307
+ *
308
+ * @example
309
+ * ```javascript
310
+ * initializeRecaptchaConfig(auth);
311
+ * ```
312
+ *
313
+ * @param auth - The {@link Auth} instance.
314
+ *
315
+ * @public
316
+ */
317
+ export declare function initializeRecaptchaConfig(auth: types.FirebaseAuth): Promise<void>;
318
+ /**
319
+ * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
320
+ *
321
+ * @param auth - The {@link Auth} instance.
322
+ * @param emailLink - The link sent to the user's email address.
323
+ *
324
+ * @public
325
+ */
326
+ export declare function isSignInWithEmailLink(auth: types.FirebaseAuth, emailLink: string): boolean;
327
+ /**
328
+ * Links the user account with the given credentials.
329
+ *
330
+ * @remarks
331
+ * An {@link AuthProvider} can be used to generate the credential.
332
+ *
333
+ * @param user - The user.
334
+ * @param credential - The auth credential.
335
+ *
336
+ * @public
337
+ */
338
+ export declare function linkWithCredential(user: types.User, credential: AuthCredential): Promise<UserCredential>;
339
+ /**
340
+ * Links the user account with the given phone number.
341
+ *
342
+ * @remarks
343
+ * This method does not work in a Node.js environment.
344
+ *
345
+ * @param user - The user.
346
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
347
+ * @param appVerifier - The {@link ApplicationVerifier}.
348
+ *
349
+ * @public
350
+ */
351
+ export declare function linkWithPhoneNumber(user: types.User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
352
+ /**
353
+ * Links the authenticated provider to the user account using a pop-up based OAuth flow.
354
+ *
355
+ * @remarks
356
+ * If the linking is successful, the returned result will contain the user and the provider's credential.
357
+ *
358
+ * This method does not work in a Node.js environment.
359
+ *
360
+ * @example
361
+ * ```javascript
362
+ * // Sign in using some other provider.
363
+ * const result = await signInWithEmailAndPassword(auth, email, password);
364
+ * // Link using a popup.
365
+ * const provider = new FacebookAuthProvider();
366
+ * await linkWithPopup(result.user, provider);
367
+ * ```
368
+ *
369
+ * @param user - The user.
370
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
371
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
372
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
373
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
374
+ *
375
+ * @public
376
+ */
377
+ export declare function linkWithPopup(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
378
+ /**
379
+ * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
380
+ * @remarks
381
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
382
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
383
+ * | best practices} when using {@link linkWithRedirect}.
384
+ *
385
+ * This method does not work in a Node.js environment or with {@link Auth} instances
386
+ * created with a {@link @firebase/app#FirebaseServerApp}.
387
+ *
388
+ * @example
389
+ * ```javascript
390
+ * // Sign in using some other provider.
391
+ * const result = await signInWithEmailAndPassword(auth, email, password);
392
+ * // Link using a redirect.
393
+ * const provider = new FacebookAuthProvider();
394
+ * await linkWithRedirect(result.user, provider);
395
+ * // This will trigger a full page redirect away from your app
396
+ *
397
+ * // After returning from the redirect when your app initializes you can obtain the result
398
+ * const result = await getRedirectResult(auth);
399
+ * ```
400
+ *
401
+ * @param user - The user.
402
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
403
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
404
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
405
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
406
+ *
407
+ * @public
408
+ */
409
+ export declare function linkWithRedirect(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
410
+ /**
411
+ * The {@link MultiFactorUser} corresponding to the user.
412
+ *
413
+ * @remarks
414
+ * This is used to access all multi-factor properties and operations related to the user.
415
+ *
416
+ * @param user - The user.
417
+ *
418
+ * @public
419
+ */
420
+ export declare function multiFactor(user: types.User): MultiFactorUser;
421
+ /**
422
+ * Adds an observer for changes to the user's sign-in state.
423
+ *
424
+ * @remarks
425
+ * To keep the old behavior, see {@link onIdTokenChanged}.
426
+ *
427
+ * @param auth - The {@link Auth} instance.
428
+ * @param nextOrObserver - callback triggered on change.
429
+ * @param error - Deprecated. This callback is never triggered. Errors
430
+ * on signing in/out can be caught in promises returned from
431
+ * sign-in/sign-out functions.
432
+ * @param completed - Deprecated. This callback is never triggered.
433
+ *
434
+ * @public
435
+ */
436
+ export declare function onAuthStateChanged(auth: types.FirebaseAuth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
437
+ /**
438
+ * Adds an observer for changes to the signed-in user's ID token.
439
+ *
440
+ * @remarks
441
+ * This includes sign-in, sign-out, and token refresh events.
442
+ * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
443
+ *
444
+ * @param auth - The {@link Auth} instance.
445
+ * @param nextOrObserver - callback triggered on change.
446
+ * @param error - Deprecated. This callback is never triggered. Errors
447
+ * on signing in/out can be caught in promises returned from
448
+ * sign-in/sign-out functions.
449
+ * @param completed - Deprecated. This callback is never triggered.
450
+ *
451
+ * @public
452
+ */
453
+ export declare function onIdTokenChanged(auth: types.FirebaseAuth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
454
+ /**
455
+ * Re-authenticates a user using a fresh credential.
456
+ *
457
+ * @remarks
458
+ * Use before operations such as {@link updatePassword} that require tokens from recent sign-in
459
+ * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
460
+ * or a `TOKEN_EXPIRED` error.
461
+ *
462
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
463
+ * created with a {@link @firebase/app#FirebaseServerApp}.
464
+ *
465
+ * @param user - The user.
466
+ * @param credential - The auth credential.
467
+ *
468
+ * @public
469
+ */
470
+ export declare function reauthenticateWithCredential(user: types.User, credential: AuthCredential): Promise<UserCredential>;
471
+ /**
472
+ * Re-authenticates a user using a fresh phone credential.
473
+ *
474
+ * @remarks
475
+ * Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
476
+ *
477
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
478
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
479
+ *
480
+ * @param user - The user.
481
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
482
+ * @param appVerifier - The {@link ApplicationVerifier}.
483
+ *
484
+ * @public
485
+ */
486
+ export declare function reauthenticateWithPhoneNumber(user: types.User, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
487
+ /**
488
+ * Reauthenticates the current user with the specified {@link OAuthProvider} using a pop-up based
489
+ * OAuth flow.
490
+ *
491
+ * @remarks
492
+ * If the reauthentication is successful, the returned result will contain the user and the
493
+ * provider's credential.
494
+ *
495
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
496
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
497
+ *
498
+ * @example
499
+ * ```javascript
500
+ * // Sign in using a popup.
501
+ * const provider = new FacebookAuthProvider();
502
+ * const result = await signInWithPopup(auth, provider);
503
+ * // Reauthenticate using a popup.
504
+ * await reauthenticateWithPopup(result.user, provider);
505
+ * ```
506
+ *
507
+ * @param user - The user.
508
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
509
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
510
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
511
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
512
+ *
513
+ * @public
514
+ */
515
+ export declare function reauthenticateWithPopup(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
516
+ /**
517
+ * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
518
+ * @remarks
519
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
520
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
521
+ * | best practices} when using {@link reauthenticateWithRedirect}.
522
+ *
523
+ * This method does not work in a Node.js environment or with {@link Auth} instances
524
+ * created with a {@link @firebase/app#FirebaseServerApp}.
525
+ *
526
+ * @example
527
+ * ```javascript
528
+ * // Sign in using a redirect.
529
+ * const provider = new FacebookAuthProvider();
530
+ * const result = await signInWithRedirect(auth, provider);
531
+ * // This will trigger a full page redirect away from your app
532
+ *
533
+ * // After returning from the redirect when your app initializes you can obtain the result
534
+ * const result = await getRedirectResult(auth);
535
+ * // Reauthenticate using a redirect.
536
+ * await reauthenticateWithRedirect(result.user, provider);
537
+ * // This will again trigger a full page redirect away from your app
538
+ *
539
+ * // After returning from the redirect when your app initializes you can obtain the result
540
+ * const result = await getRedirectResult(auth);
541
+ * ```
542
+ *
543
+ * @param user - The user.
544
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
545
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
546
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
547
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
548
+ *
549
+ * @public
550
+ */
551
+ export declare function reauthenticateWithRedirect(user: types.User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
552
+ /**
553
+ * Reloads user account data, if signed in.
554
+ *
555
+ * @param user - The user.
556
+ *
557
+ * @public
558
+ */
559
+ export declare function reload(user: types.User): Promise<void>;
560
+ /**
561
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
562
+ *
563
+ * @param auth - The {@link Auth} instance.
564
+ * @param token - The Apple OAuth access token.
565
+ *
566
+ * @public
567
+ */
568
+ export declare function revokeAccessToken(auth: types.FirebaseAuth, token: string): Promise<void>;
569
+ /**
570
+ * Sends a verification email to a user.
571
+ *
572
+ * @remarks
573
+ * The verification process is completed by calling {@link applyActionCode}.
574
+ *
575
+ * @example
576
+ * ```javascript
577
+ * const actionCodeSettings = {
578
+ * url: 'https://www.example.com/?email=user@example.com',
579
+ * iOS: {
580
+ * bundleId: 'com.example.ios'
581
+ * },
582
+ * android: {
583
+ * packageName: 'com.example.android',
584
+ * installApp: true,
585
+ * minimumVersion: '12'
586
+ * },
587
+ * handleCodeInApp: true
588
+ * };
589
+ * await sendEmailVerification(user, actionCodeSettings);
590
+ * // Obtain code from the user.
591
+ * await applyActionCode(auth, code);
592
+ * ```
593
+ *
594
+ * @param user - The user.
595
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
596
+ *
597
+ * @public
598
+ */
599
+ export declare function sendEmailVerification(user: types.User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
600
+ /**
601
+ * Sends a password reset email to the given email address. This method does not throw an error when
602
+ * there's no user account with the given email address and
603
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
604
+ * is enabled.
605
+ *
606
+ * @remarks
607
+ * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
608
+ * the email sent to the user, along with the new password specified by the user.
609
+ *
610
+ * @example
611
+ * ```javascript
612
+ * const actionCodeSettings = {
613
+ * url: 'https://www.example.com/?email=user@example.com',
614
+ * iOS: {
615
+ * bundleId: 'com.example.ios'
616
+ * },
617
+ * android: {
618
+ * packageName: 'com.example.android',
619
+ * installApp: true,
620
+ * minimumVersion: '12'
621
+ * },
622
+ * handleCodeInApp: true
623
+ * };
624
+ * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);
625
+ * // Obtain code from user.
626
+ * await confirmPasswordReset('user@example.com', code);
627
+ * ```
628
+ *
629
+ * @param auth - The {@link Auth} instance.
630
+ * @param email - The user's email address.
631
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
632
+ *
633
+ * @public
634
+ */
635
+ export declare function sendPasswordResetEmail(auth: types.FirebaseAuth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
636
+ /**
637
+ * Sends a sign-in email link to the user with the specified email.
638
+ *
639
+ * @remarks
640
+ * The sign-in operation has to always be completed in the app unlike other out of band email
641
+ * actions (password reset and email verifications). This is because, at the end of the flow,
642
+ * the user is expected to be signed in and their Auth state persisted within the app.
643
+ *
644
+ * To complete sign in with the email link, call {@link signInWithEmailLink} with the email
645
+ * address and the email link supplied in the email sent to the user.
646
+ *
647
+ * @example
648
+ * ```javascript
649
+ * const actionCodeSettings = {
650
+ * url: 'https://www.example.com/?email=user@example.com',
651
+ * iOS: {
652
+ * bundleId: 'com.example.ios'
653
+ * },
654
+ * android: {
655
+ * packageName: 'com.example.android',
656
+ * installApp: true,
657
+ * minimumVersion: '12'
658
+ * },
659
+ * handleCodeInApp: true
660
+ * };
661
+ * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
662
+ * // Obtain emailLink from the user.
663
+ * if(isSignInWithEmailLink(auth, emailLink)) {
664
+ * await signInWithEmailLink(auth, 'user@example.com', emailLink);
665
+ * }
666
+ * ```
667
+ *
668
+ * @param authInternal - The {@link Auth} instance.
669
+ * @param email - The user's email address.
670
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
671
+ *
672
+ * @public
673
+ */
674
+ export declare function sendSignInLinkToEmail(auth: types.FirebaseAuth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;
675
+ /**
676
+ * Changes the type of persistence on the {@link Auth} instance for the currently saved
677
+ * `Auth` session and applies this type of persistence for future sign-in requests, including
678
+ * sign-in with redirect requests.
679
+ *
680
+ * @remarks
681
+ * This makes it easy for a user signing in to specify whether their session should be
682
+ * remembered or not. It also makes it easier to never persist the `Auth` state for applications
683
+ * that are shared by other users or have sensitive data.
684
+ *
685
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
686
+ * {@link @firebase/app#FirebaseServerApp}.
687
+ *
688
+ * @example
689
+ * ```javascript
690
+ * setPersistence(auth, browserSessionPersistence);
691
+ * ```
692
+ *
693
+ * @param auth - The {@link Auth} instance.
694
+ * @param persistence - The {@link Persistence} to use.
695
+ * @returns A `Promise` that resolves once the persistence change has completed
696
+ *
697
+ * @public
698
+ */
699
+ export declare function setPersistence(auth: types.FirebaseAuth, persistence: Persistence): Promise<void>;
700
+ /**
701
+ * Asynchronously signs in as an anonymous user.
702
+ *
703
+ * @remarks
704
+ * If there is already an anonymous user signed in, that user will be returned; otherwise, a
705
+ * new anonymous user identity will be created and returned.
706
+ *
707
+ * This method is not supported by {@link Auth} instances created with a
708
+ * {@link @firebase/app#FirebaseServerApp}.
709
+ *
710
+ * @param auth - The {@link Auth} instance.
711
+ *
712
+ * @public
713
+ */
714
+ export declare function signInAnonymously(auth: types.FirebaseAuth): Promise<UserCredential>;
715
+ /**
716
+ * Asynchronously signs in with the given credentials.
717
+ *
718
+ * @remarks
719
+ * An {@link AuthProvider} can be used to generate the credential.
720
+ *
721
+ * This method is not supported by {@link Auth} instances created with a
722
+ * {@link @firebase/app#FirebaseServerApp}.
723
+ *
724
+ * @param auth - The {@link Auth} instance.
725
+ * @param credential - The auth credential.
726
+ *
727
+ * @public
728
+ */
729
+ export declare function signInWithCredential(auth: types.FirebaseAuth, credential: AuthCredential): Promise<UserCredential>;
730
+ /**
731
+ * Asynchronously signs in using a custom token.
732
+ *
733
+ * @remarks
734
+ * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must
735
+ * be generated by an auth backend using the
736
+ * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}
737
+ * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .
738
+ *
739
+ * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
740
+ *
741
+ * This method is not supported by {@link Auth} instances created with a
742
+ * {@link @firebase/app#FirebaseServerApp}.
743
+ *
744
+ * @param auth - The {@link Auth} instance.
745
+ * @param customToken - The custom token to sign in with.
746
+ *
747
+ * @public
748
+ */
749
+ export declare function signInWithCustomToken(auth: types.FirebaseAuth, customToken: string): Promise<UserCredential>;
750
+ /**
751
+ * Asynchronously signs in using an email and password.
752
+ *
753
+ * @remarks
754
+ * Fails with an error if the email address and password do not match. When
755
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
756
+ * is enabled, this method fails with "auth/invalid-credential" in case of an invalid
757
+ * email/password.
758
+ *
759
+ * This method is not supported on {@link Auth} instances created with a
760
+ * {@link @firebase/app#FirebaseServerApp}.
761
+ *
762
+ * Note: The user's password is NOT the password used to access the user's email account. The
763
+ * email address serves as a unique identifier for the user, and the password is used to access
764
+ * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
765
+ *
766
+ *
767
+ * @param auth - The {@link Auth} instance.
768
+ * @param email - The users email address.
769
+ * @param password - The users password.
770
+ *
771
+ * @public
772
+ */
773
+ export declare function signInWithEmailAndPassword(auth: types.FirebaseAuth, email: string, password: string): Promise<UserCredential>;
774
+ /**
775
+ * Asynchronously signs in using an email and sign-in email link.
776
+ *
777
+ * @remarks
778
+ * If no link is passed, the link is inferred from the current URL.
779
+ *
780
+ * Fails with an error if the email address is invalid or OTP in email link expires.
781
+ *
782
+ * This method is not supported by {@link Auth} instances created with a
783
+ * {@link @firebase/app#FirebaseServerApp}.
784
+ *
785
+ * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
786
+ *
787
+ * @example
788
+ * ```javascript
789
+ * const actionCodeSettings = {
790
+ * url: 'https://www.example.com/?email=user@example.com',
791
+ * iOS: {
792
+ * bundleId: 'com.example.ios'
793
+ * },
794
+ * android: {
795
+ * packageName: 'com.example.android',
796
+ * installApp: true,
797
+ * minimumVersion: '12'
798
+ * },
799
+ * handleCodeInApp: true
800
+ * };
801
+ * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
802
+ * // Obtain emailLink from the user.
803
+ * if(isSignInWithEmailLink(auth, emailLink)) {
804
+ * await signInWithEmailLink(auth, 'user@example.com', emailLink);
805
+ * }
806
+ * ```
807
+ *
808
+ *
809
+ * @param auth - The {@link Auth} instance.
810
+ * @param email - The user's email address.
811
+ * @param emailLink - The link sent to the user's email address.
812
+ *
813
+ * @public
814
+ */
815
+ export declare function signInWithEmailLink(auth: types.FirebaseAuth, email: string, emailLink?: string): Promise<UserCredential>;
816
+ /* Excluded from this release type: SignInWithIdpResponse */
817
+ /**
818
+ * Asynchronously signs in using a phone number.
819
+ *
820
+ * @remarks
821
+ * This method sends a code via SMS to the given
822
+ * phone number, and returns a {@link ConfirmationResult}. After the user
823
+ * provides the code sent to their phone, call {@link ConfirmationResult.confirm}
824
+ * with the code to sign the user in.
825
+ *
826
+ * For abuse prevention, this method requires a {@link ApplicationVerifier}.
827
+ * This SDK includes an implementation based on reCAPTCHA v2, {@link RecaptchaVerifier}.
828
+ * This function can work on other platforms that do not support the
829
+ * {@link RecaptchaVerifier} (like React Native), but you need to use a
830
+ * third-party {@link ApplicationVerifier} implementation.
831
+ *
832
+ * If you've enabled project-level reCAPTCHA Enterprise bot protection in
833
+ * Enforce mode, you can omit the {@link ApplicationVerifier}.
834
+ *
835
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
836
+ * {@link @firebase/app#FirebaseServerApp}.
837
+ *
838
+ * @example
839
+ * ```javascript
840
+ * // 'recaptcha-container' is the ID of an element in the DOM.
841
+ * const applicationVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
842
+ * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
843
+ * // Obtain a verificationCode from the user.
844
+ * const credential = await confirmationResult.confirm(verificationCode);
845
+ * ```
846
+ *
847
+ * @param auth - The {@link Auth} instance.
848
+ * @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
849
+ * @param appVerifier - The {@link ApplicationVerifier}.
850
+ *
851
+ * @public
852
+ */
853
+ export declare function signInWithPhoneNumber(auth: types.FirebaseAuth, phoneNumber: string, appVerifier?: ApplicationVerifier): Promise<ConfirmationResult>;
854
+ /* Excluded from this release type: SignInWithPhoneNumberRequest */
855
+ /* Excluded from this release type: SignInWithPhoneNumberResponse */
856
+ /**
857
+ * Authenticates a Firebase client using a popup-based OAuth authentication flow.
858
+ *
859
+ * @remarks
860
+ * If succeeds, returns the signed in user along with the provider's credential. If sign in was
861
+ * unsuccessful, returns an error object containing additional information about the error.
862
+ *
863
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
864
+ * {@link @firebase/app#FirebaseServerApp}.
865
+ *
866
+ * @example
867
+ * ```javascript
868
+ * // Sign in using a popup.
869
+ * const provider = new FacebookAuthProvider();
870
+ * const result = await signInWithPopup(auth, provider);
871
+ *
872
+ * // The signed-in user info.
873
+ * const user = result.user;
874
+ * // This gives you a Facebook Access Token.
875
+ * const credential = provider.credentialFromResult(auth, result);
876
+ * const token = credential.accessToken;
877
+ * ```
878
+ *
879
+ * @param auth - The {@link Auth} instance.
880
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
881
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
882
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
883
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
884
+ *
885
+ * @public
886
+ */
887
+ export declare function signInWithPopup(auth: types.FirebaseAuth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<UserCredential>;
888
+ /**
889
+ * Authenticates a Firebase client using a full-page redirect flow.
890
+ *
891
+ * @remarks
892
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
893
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
894
+ * | best practices} when using {@link signInWithRedirect}.
895
+ *
896
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
897
+ * {@link @firebase/app#FirebaseServerApp}.
898
+ *
899
+ * @example
900
+ * ```javascript
901
+ * // Sign in using a redirect.
902
+ * const provider = new FacebookAuthProvider();
903
+ * // You can add additional scopes to the provider:
904
+ * provider.addScope('user_birthday');
905
+ * // Start a sign in process for an unauthenticated user.
906
+ * await signInWithRedirect(auth, provider);
907
+ * // This will trigger a full page redirect away from your app
908
+ *
909
+ * // After returning from the redirect when your app initializes you can obtain the result
910
+ * const result = await getRedirectResult(auth);
911
+ * if (result) {
912
+ * // This is the signed-in user
913
+ * const user = result.user;
914
+ * // This gives you a Facebook Access Token.
915
+ * const credential = provider.credentialFromResult(auth, result);
916
+ * const token = credential.accessToken;
917
+ * }
918
+ * // As this API can be used for sign-in, linking and reauthentication,
919
+ * // check the operationType to determine what triggered this redirect
920
+ * // operation.
921
+ * const operationType = result.operationType;
922
+ * ```
923
+ *
924
+ * @param auth - The {@link Auth} instance.
925
+ * @param provider - The provider to authenticate. The provider has to be an {@link OAuthProvider}.
926
+ * Non-OAuth providers like {@link EmailAuthProvider} will throw an error.
927
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
928
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
929
+ *
930
+ * @public
931
+ */
932
+ export declare function signInWithRedirect(auth: types.FirebaseAuth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<never>;
933
+ /**
934
+ * Signs out the current user.
935
+ *
936
+ * @remarks
937
+ * This method is not supported by {@link Auth} instances created with a
938
+ * {@link @firebase/app#FirebaseServerApp}.
939
+ *
940
+ * @param auth - The {@link Auth} instance.
941
+ *
942
+ * @public
943
+ */
944
+ export declare function signOut(auth: types.FirebaseAuth): Promise<void>;
945
+ /**
946
+ * Unlinks a provider from a user account.
947
+ *
948
+ * @param user - The user.
949
+ * @param providerId - The provider to unlink.
950
+ *
951
+ * @public
952
+ */
953
+ export declare function unlink(user: types.User, providerId: string): Promise<User>;
954
+ /**
955
+ * Asynchronously sets the provided user as {@link Auth.currentUser} on the
956
+ * {@link Auth} instance.
957
+ *
958
+ * @remarks
959
+ * A new instance copy of the user provided will be made and set as currentUser.
960
+ *
961
+ * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners
962
+ * like other sign in methods.
963
+ *
964
+ * The operation fails with an error if the user to be updated belongs to a different Firebase
965
+ * project.
966
+ *
967
+ * This method is not supported by {@link Auth} instances created with a
968
+ * {@link @firebase/app#FirebaseServerApp}.
969
+ *
970
+ * @param auth - The {@link Auth} instance.
971
+ * @param user - The new {@link User}.
972
+ *
973
+ * @public
974
+ */
975
+ export declare function updateCurrentUser(auth: types.FirebaseAuth, user: User | null): Promise<void>;
976
+ /**
977
+ * Updates the user's email address.
978
+ *
979
+ * @remarks
980
+ * An email will be sent to the original email address (if it was set) that allows to revoke the
981
+ * email address change, in order to protect them from account hijacking.
982
+ *
983
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
984
+ * created with a {@link @firebase/app#FirebaseServerApp}.
985
+ *
986
+ * Important: this is a security sensitive operation that requires the user to have recently signed
987
+ * in. If this requirement isn't met, ask the user to authenticate again and then call
988
+ * {@link reauthenticateWithCredential}.
989
+ *
990
+ * @param user - The user.
991
+ * @param newEmail - The new email address.
992
+ *
993
+ * Throws "auth/operation-not-allowed" error when
994
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
995
+ * is enabled.
996
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
997
+ *
998
+ * @public
999
+ */
1000
+ export declare function updateEmail(user: types.User, newEmail: string): Promise<void>;
1001
+ /**
1002
+ * Updates the user's password.
1003
+ *
1004
+ * @remarks
1005
+ * Important: this is a security sensitive operation that requires the user to have recently signed
1006
+ * in. If this requirement isn't met, ask the user to authenticate again and then call
1007
+ * {@link reauthenticateWithCredential}.
1008
+ *
1009
+ * @param user - The user.
1010
+ * @param newPassword - The new password.
1011
+ *
1012
+ * @public
1013
+ */
1014
+ export declare function updatePassword(user: types.User, newPassword: string): Promise<void>;
1015
+ /**
1016
+ * Updates the user's phone number.
1017
+ *
1018
+ * @remarks
1019
+ * This method does not work in a Node.js environment or on any {@link User} signed in by
1020
+ * {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
1021
+ *
1022
+ * @example
1023
+ * ```
1024
+ * // 'recaptcha-container' is the ID of an element in the DOM.
1025
+ * const applicationVerifier = new RecaptchaVerifier('recaptcha-container');
1026
+ * const provider = new PhoneAuthProvider(auth);
1027
+ * const verificationId = await provider.verifyPhoneNumber('+16505550101', applicationVerifier);
1028
+ * // Obtain the verificationCode from the user.
1029
+ * const phoneCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
1030
+ * await updatePhoneNumber(user, phoneCredential);
1031
+ * ```
1032
+ *
1033
+ * @param user - The user.
1034
+ * @param credential - A credential authenticating the new phone number.
1035
+ *
1036
+ * @public
1037
+ */
1038
+ export declare function updatePhoneNumber(user: types.User, credential: PhoneAuthCredential): Promise<void>;
1039
+ /**
1040
+ * Updates a user's profile data.
1041
+ *
1042
+ * @param user - The user.
1043
+ * @param profile - The profile's `displayName` and `photoURL` to update.
1044
+ *
1045
+ * @public
1046
+ */
1047
+ export declare function updateProfile(user: types.User, { displayName, photoURL: photoUrl }: {
105
1048
  displayName?: string | null;
106
1049
  photoURL?: string | null;
107
1050
  }): Promise<void>;
108
- function useDeviceLanguage(auth: types.FirebaseAuth): void;
109
- function validatePassword(auth: types.FirebaseAuth, password: string): Promise<PasswordValidationStatus>;
110
- function verifyBeforeUpdateEmail(user: types.User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
111
- function verifyPasswordResetCode(auth: types.FirebaseAuth, code: string): Promise<string>;
1051
+ /**
1052
+ * Sets the current language to the default device/browser preference.
1053
+ *
1054
+ * @param auth - The {@link Auth} instance.
1055
+ *
1056
+ * @public
1057
+ */
1058
+ export declare function useDeviceLanguage(auth: types.FirebaseAuth): void;
1059
+ /**
1060
+ * Validates the password against the password policy configured for the project or tenant.
1061
+ *
1062
+ * @remarks
1063
+ * If no tenant ID is set on the `Auth` instance, then this method will use the password
1064
+ * policy configured for the project. Otherwise, this method will use the policy configured
1065
+ * for the tenant. If a password policy has not been configured, then the default policy
1066
+ * configured for all projects will be used.
1067
+ *
1068
+ * If an auth flow fails because a submitted password does not meet the password policy
1069
+ * requirements and this method has previously been called, then this method will use the
1070
+ * most recent policy available when called again.
1071
+ *
1072
+ * @example
1073
+ * ```javascript
1074
+ * validatePassword(auth, 'some-password');
1075
+ * ```
1076
+ *
1077
+ * @param auth The {@link Auth} instance.
1078
+ * @param password The password to validate.
1079
+ *
1080
+ * @public
1081
+ */
1082
+ export declare function validatePassword(auth: types.FirebaseAuth, password: string): Promise<PasswordValidationStatus>;
1083
+ /**
1084
+ * Sends a verification email to a new email address.
1085
+ *
1086
+ * @remarks
1087
+ * The user's email will be updated to the new one after being verified.
1088
+ *
1089
+ * If you have a custom email action handler, you can complete the verification process by calling
1090
+ * {@link applyActionCode}.
1091
+ *
1092
+ * @example
1093
+ * ```javascript
1094
+ * const actionCodeSettings = {
1095
+ * url: 'https://www.example.com/?email=user@example.com',
1096
+ * iOS: {
1097
+ * bundleId: 'com.example.ios'
1098
+ * },
1099
+ * android: {
1100
+ * packageName: 'com.example.android',
1101
+ * installApp: true,
1102
+ * minimumVersion: '12'
1103
+ * },
1104
+ * handleCodeInApp: true
1105
+ * };
1106
+ * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
1107
+ * // Obtain code from the user.
1108
+ * await applyActionCode(auth, code);
1109
+ * ```
1110
+ *
1111
+ * @param user - The user.
1112
+ * @param newEmail - The new email address to be verified before update.
1113
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
1114
+ *
1115
+ * @public
1116
+ */
1117
+ export declare function verifyBeforeUpdateEmail(user: types.User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
1118
+ /**
1119
+ * Checks a password reset code sent to the user by email or other out-of-band mechanism.
1120
+ *
1121
+ * @returns the user's email address if valid.
1122
+ *
1123
+ * @param auth - The {@link Auth} instance.
1124
+ * @param code - A verification code sent to the user.
1125
+ *
1126
+ * @public
1127
+ */
1128
+ export declare function verifyPasswordResetCode(auth: types.FirebaseAuth, code: string): Promise<string>;
112
1129
  }