@firebase/auth 1.7.2 → 1.7.3-canary.0af23e02e

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 (46) hide show
  1. package/cordova/package.json +2 -2
  2. package/dist/browser-cjs/{index-f7b63e3f.js → index-57079332.js} +2 -2
  3. package/dist/browser-cjs/{index-f7b63e3f.js.map → index-57079332.js.map} +1 -1
  4. package/dist/browser-cjs/index.js +1 -1
  5. package/dist/browser-cjs/internal.js +1 -1
  6. package/dist/cordova/auth-cordova-public.d.ts +3358 -0
  7. package/dist/cordova/auth-cordova.d.ts +3906 -0
  8. package/dist/cordova/index.js +2 -2
  9. package/dist/cordova/internal.js +2 -2
  10. package/dist/cordova/{popup_redirect-b4b5a188.js → popup_redirect-4c073a44.js} +2 -2
  11. package/dist/cordova/{popup_redirect-b4b5a188.js.map → popup_redirect-4c073a44.js.map} +1 -1
  12. package/dist/cordova/tsdoc-metadata.json +11 -0
  13. package/dist/esm2017/{index-fbeda258.js → index-2995ec35.js} +2 -2
  14. package/dist/esm2017/{index-fbeda258.js.map → index-2995ec35.js.map} +1 -1
  15. package/dist/esm2017/index.js +1 -1
  16. package/dist/esm2017/internal.js +2 -2
  17. package/dist/esm5/{index-4db8e4e0.js → index-408f0b75.js} +2 -2
  18. package/dist/esm5/{index-4db8e4e0.js.map → index-408f0b75.js.map} +1 -1
  19. package/dist/esm5/index.js +1 -1
  20. package/dist/esm5/internal.js +2 -2
  21. package/dist/index.webworker.esm5.js +1 -1
  22. package/dist/node/index.js +1 -1
  23. package/dist/node/internal.js +1 -1
  24. package/dist/node/{totp-8e0716ef.js → totp-bc02a833.js} +2 -2
  25. package/dist/node/{totp-8e0716ef.js.map → totp-bc02a833.js.map} +1 -1
  26. package/dist/node-esm/index.js +1 -1
  27. package/dist/node-esm/internal.js +2 -2
  28. package/dist/node-esm/{totp-cb6285c7.js → totp-39d4143d.js} +2 -2
  29. package/dist/node-esm/{totp-cb6285c7.js.map → totp-39d4143d.js.map} +1 -1
  30. package/dist/rn/{index-80328d7b.js → index-f098d2f4.js} +2 -2
  31. package/dist/rn/{index-80328d7b.js.map → index-f098d2f4.js.map} +1 -1
  32. package/dist/rn/index.js +1 -1
  33. package/dist/rn/internal.js +1 -1
  34. package/dist/web-extension-cjs/index.js +1 -1
  35. package/dist/web-extension-cjs/internal.js +1 -1
  36. package/dist/web-extension-cjs/{register-887c11b1.js → register-7a1e378c.js} +2 -2
  37. package/dist/web-extension-cjs/{register-887c11b1.js.map → register-7a1e378c.js.map} +1 -1
  38. package/dist/web-extension-esm2017/auth-web-extension-public.d.ts +3171 -0
  39. package/dist/web-extension-esm2017/auth-web-extension.d.ts +3721 -0
  40. package/dist/web-extension-esm2017/index.js +2 -2
  41. package/dist/web-extension-esm2017/internal.js +2 -2
  42. package/dist/web-extension-esm2017/{register-d665f4d5.js → register-ddc6d4be.js} +2 -2
  43. package/dist/web-extension-esm2017/{register-d665f4d5.js.map → register-ddc6d4be.js.map} +1 -1
  44. package/dist/web-extension-esm2017/tsdoc-metadata.json +11 -0
  45. package/package.json +9 -9
  46. package/web-extension/package.json +2 -2
@@ -0,0 +1,3358 @@
1
+ import { CompleteFn } from '@firebase/util';
2
+ import { ErrorFactory } from '@firebase/util';
3
+ import { ErrorFn } from '@firebase/util';
4
+ import { FirebaseApp } from '@firebase/app';
5
+ import { FirebaseError } from '@firebase/util';
6
+ import { NextFn } from '@firebase/util';
7
+ import { Observer } from '@firebase/util';
8
+ import { Unsubscribe } from '@firebase/util';
9
+
10
+ /**
11
+ * A response from {@link checkActionCode}.
12
+ *
13
+ * @public
14
+ */
15
+ export declare interface ActionCodeInfo {
16
+ /**
17
+ * The data associated with the action code.
18
+ *
19
+ * @remarks
20
+ * For the {@link ActionCodeOperation}.PASSWORD_RESET, {@link ActionCodeOperation}.VERIFY_EMAIL, and
21
+ * {@link ActionCodeOperation}.RECOVER_EMAIL actions, this object contains an email field with the address
22
+ * the email was sent to.
23
+ *
24
+ * For the {@link ActionCodeOperation}.RECOVER_EMAIL action, which allows a user to undo an email address
25
+ * change, this object also contains a `previousEmail` field with the user account's current
26
+ * email address. After the action completes, the user's email address will revert to the value
27
+ * in the `email` field from the value in `previousEmail` field.
28
+ *
29
+ * For the {@link ActionCodeOperation}.VERIFY_AND_CHANGE_EMAIL action, which allows a user to verify the
30
+ * email before updating it, this object contains a `previousEmail` field with the user account's
31
+ * email address before updating. After the action completes, the user's email address will be
32
+ * updated to the value in the `email` field from the value in `previousEmail` field.
33
+ *
34
+ * For the {@link ActionCodeOperation}.REVERT_SECOND_FACTOR_ADDITION action, which allows a user to
35
+ * unenroll a newly added second factor, this object contains a `multiFactorInfo` field with
36
+ * the information about the second factor. For phone second factor, the `multiFactorInfo`
37
+ * is a {@link MultiFactorInfo} object, which contains the phone number.
38
+ */
39
+ data: {
40
+ email?: string | null;
41
+ multiFactorInfo?: MultiFactorInfo | null;
42
+ previousEmail?: string | null;
43
+ };
44
+ /**
45
+ * The type of operation that generated the action code.
46
+ */
47
+ operation: (typeof ActionCodeOperation)[keyof typeof ActionCodeOperation];
48
+ }
49
+
50
+ /**
51
+ * An enumeration of the possible email action types.
52
+ *
53
+ * @public
54
+ */
55
+ export declare const ActionCodeOperation: {
56
+ /** The email link sign-in action. */
57
+ readonly EMAIL_SIGNIN: "EMAIL_SIGNIN";
58
+ /** The password reset action. */
59
+ readonly PASSWORD_RESET: "PASSWORD_RESET";
60
+ /** The email revocation action. */
61
+ readonly RECOVER_EMAIL: "RECOVER_EMAIL";
62
+ /** The revert second factor addition email action. */
63
+ readonly REVERT_SECOND_FACTOR_ADDITION: "REVERT_SECOND_FACTOR_ADDITION";
64
+ /** The revert second factor addition email action. */
65
+ readonly VERIFY_AND_CHANGE_EMAIL: "VERIFY_AND_CHANGE_EMAIL";
66
+ /** The email verification action. */
67
+ readonly VERIFY_EMAIL: "VERIFY_EMAIL";
68
+ };
69
+
70
+ /**
71
+ * An interface that defines the required continue/state URL with optional Android and iOS
72
+ * bundle identifiers.
73
+ *
74
+ * @public
75
+ */
76
+ export declare interface ActionCodeSettings {
77
+ /**
78
+ * Sets the Android package name.
79
+ *
80
+ * @remarks
81
+ * This will try to open the link in an android app if it is
82
+ * installed. If `installApp` is passed, it specifies whether to install the Android app if the
83
+ * device supports it and the app is not already installed. If this field is provided without
84
+ * a `packageName`, an error is thrown explaining that the `packageName` must be provided in
85
+ * conjunction with this field. If `minimumVersion` is specified, and an older version of the
86
+ * app is installed, the user is taken to the Play Store to upgrade the app.
87
+ */
88
+ android?: {
89
+ installApp?: boolean;
90
+ minimumVersion?: string;
91
+ packageName: string;
92
+ };
93
+ /**
94
+ * When set to true, the action code link will be be sent as a Universal Link or Android App
95
+ * Link and will be opened by the app if installed.
96
+ *
97
+ * @remarks
98
+ * In the false case, the code will be sent to the web widget first and then on continue will
99
+ * redirect to the app if installed.
100
+ *
101
+ * @defaultValue false
102
+ */
103
+ handleCodeInApp?: boolean;
104
+ /**
105
+ * Sets the iOS bundle ID.
106
+ *
107
+ * @remarks
108
+ * This will try to open the link in an iOS app if it is installed.
109
+ *
110
+ * App installation is not supported for iOS.
111
+ */
112
+ iOS?: {
113
+ bundleId: string;
114
+ };
115
+ /**
116
+ * Sets the link continue/state URL.
117
+ *
118
+ * @remarks
119
+ * This has different meanings in different contexts:
120
+ * - When the link is handled in the web action widgets, this is the deep link in the
121
+ * `continueUrl` query parameter.
122
+ * - When the link is handled in the app directly, this is the `continueUrl` query parameter in
123
+ * the deep link of the Dynamic Link.
124
+ */
125
+ url: string;
126
+ /**
127
+ * When multiple custom dynamic link domains are defined for a project, specify which one to use
128
+ * when the link is to be opened via a specified mobile app (for example, `example.page.link`).
129
+ *
130
+ *
131
+ * @defaultValue The first domain is automatically selected.
132
+ */
133
+ dynamicLinkDomain?: string;
134
+ }
135
+
136
+ /**
137
+ * @license
138
+ * Copyright 2020 Google LLC
139
+ *
140
+ * Licensed under the Apache License, Version 2.0 (the "License");
141
+ * you may not use this file except in compliance with the License.
142
+ * You may obtain a copy of the License at
143
+ *
144
+ * http://www.apache.org/licenses/LICENSE-2.0
145
+ *
146
+ * Unless required by applicable law or agreed to in writing, software
147
+ * distributed under the License is distributed on an "AS IS" BASIS,
148
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
+ * See the License for the specific language governing permissions and
150
+ * limitations under the License.
151
+ */
152
+ /**
153
+ * A utility class to parse email action URLs such as password reset, email verification,
154
+ * email link sign in, etc.
155
+ *
156
+ * @public
157
+ */
158
+ export declare class ActionCodeURL {
159
+ /**
160
+ * The API key of the email action link.
161
+ */
162
+ readonly apiKey: string;
163
+ /**
164
+ * The action code of the email action link.
165
+ */
166
+ readonly code: string;
167
+ /**
168
+ * The continue URL of the email action link. Null if not provided.
169
+ */
170
+ readonly continueUrl: string | null;
171
+ /**
172
+ * The language code of the email action link. Null if not provided.
173
+ */
174
+ readonly languageCode: string | null;
175
+ /**
176
+ * The action performed by the email action link. It returns from one of the types from
177
+ * {@link ActionCodeInfo}
178
+ */
179
+ readonly operation: string;
180
+ /**
181
+ * The tenant ID of the email action link. Null if the email action is from the parent project.
182
+ */
183
+ readonly tenantId: string | null;
184
+ /* Excluded from this release type: __constructor */
185
+ /**
186
+ * Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
187
+ * otherwise returns null.
188
+ *
189
+ * @param link - The email action link string.
190
+ * @returns The {@link ActionCodeURL} object, or null if the link is invalid.
191
+ *
192
+ * @public
193
+ */
194
+ static parseLink(link: string): ActionCodeURL | null;
195
+ }
196
+
197
+ /**
198
+ * A structure containing additional user information from a federated identity provider.
199
+ *
200
+ * @public
201
+ */
202
+ export declare interface AdditionalUserInfo {
203
+ /**
204
+ * Whether the user is new (created via sign-up) or existing (authenticated using sign-in).
205
+ */
206
+ readonly isNewUser: boolean;
207
+ /**
208
+ * Map containing IDP-specific user data.
209
+ */
210
+ readonly profile: Record<string, unknown> | null;
211
+ /**
212
+ * Identifier for the provider used to authenticate this user.
213
+ */
214
+ readonly providerId: string | null;
215
+ /**
216
+ * The username if the provider is GitHub or Twitter.
217
+ */
218
+ readonly username?: string | null;
219
+ }
220
+
221
+ declare interface APIUserInfo {
222
+ localId?: string;
223
+ displayName?: string;
224
+ photoUrl?: string;
225
+ email?: string;
226
+ emailVerified?: boolean;
227
+ phoneNumber?: string;
228
+ lastLoginAt?: number;
229
+ createdAt?: number;
230
+ tenantId?: string;
231
+ passwordHash?: string;
232
+ providerUserInfo?: ProviderUserInfo[];
233
+ mfaInfo?: MfaEnrollment[];
234
+ }
235
+
236
+ /**
237
+ * A verifier for domain verification and abuse prevention.
238
+ *
239
+ * @remarks
240
+ * Currently, the only implementation is {@link RecaptchaVerifier}.
241
+ *
242
+ * @public
243
+ */
244
+ export declare interface ApplicationVerifier {
245
+ /**
246
+ * Identifies the type of application verifier (e.g. "recaptcha").
247
+ */
248
+ readonly type: string;
249
+ /**
250
+ * Executes the verification process.
251
+ *
252
+ * @returns A Promise for a token that can be used to assert the validity of a request.
253
+ */
254
+ verify(): Promise<string>;
255
+ }
256
+
257
+ /**
258
+ * Applies a verification code sent to the user by email or other out-of-band mechanism.
259
+ *
260
+ * @param auth - The {@link Auth} instance.
261
+ * @param oobCode - A verification code sent to the user.
262
+ *
263
+ * @public
264
+ */
265
+ export declare function applyActionCode(auth: Auth, oobCode: string): Promise<void>;
266
+
267
+ declare type AppName = string;
268
+
269
+ /**
270
+ * Interface representing Firebase Auth service.
271
+ *
272
+ * @remarks
273
+ * See {@link https://firebase.google.com/docs/auth/ | Firebase Authentication} for a full guide
274
+ * on how to use the Firebase Auth service.
275
+ *
276
+ * @public
277
+ */
278
+ export declare interface Auth {
279
+ /** The {@link @firebase/app#FirebaseApp} associated with the `Auth` service instance. */
280
+ readonly app: FirebaseApp;
281
+ /** The name of the app associated with the `Auth` service instance. */
282
+ readonly name: string;
283
+ /** The {@link Config} used to initialize this instance. */
284
+ readonly config: Config;
285
+ /**
286
+ * Changes the type of persistence on the `Auth` instance.
287
+ *
288
+ * @remarks
289
+ * This will affect the currently saved Auth session and applies this type of persistence for
290
+ * future sign-in requests, including sign-in with redirect requests.
291
+ *
292
+ * This makes it easy for a user signing in to specify whether their session should be
293
+ * remembered or not. It also makes it easier to never persist the Auth state for applications
294
+ * that are shared by other users or have sensitive data.
295
+ *
296
+ * This method does not work in a Node.js environment.
297
+ *
298
+ * @example
299
+ * ```javascript
300
+ * auth.setPersistence(browserSessionPersistence);
301
+ * ```
302
+ *
303
+ * @param persistence - The {@link Persistence} to use.
304
+ */
305
+ setPersistence(persistence: Persistence): Promise<void>;
306
+ /**
307
+ * The {@link Auth} instance's language code.
308
+ *
309
+ * @remarks
310
+ * This is a readable/writable property. When set to null, the default Firebase Console language
311
+ * setting is applied. The language code will propagate to email action templates (password
312
+ * reset, email verification and email change revocation), SMS templates for phone authentication,
313
+ * reCAPTCHA verifier and OAuth popup/redirect operations provided the specified providers support
314
+ * localization with the language code specified.
315
+ */
316
+ languageCode: string | null;
317
+ /**
318
+ * The {@link Auth} instance's tenant ID.
319
+ *
320
+ * @remarks
321
+ * This is a readable/writable property. When you set the tenant ID of an {@link Auth} instance, all
322
+ * future sign-in/sign-up operations will pass this tenant ID and sign in or sign up users to
323
+ * the specified tenant project. When set to null, users are signed in to the parent project.
324
+ *
325
+ * @example
326
+ * ```javascript
327
+ * // Set the tenant ID on Auth instance.
328
+ * auth.tenantId = 'TENANT_PROJECT_ID';
329
+ *
330
+ * // All future sign-in request now include tenant ID.
331
+ * const result = await signInWithEmailAndPassword(auth, email, password);
332
+ * // result.user.tenantId should be 'TENANT_PROJECT_ID'.
333
+ * ```
334
+ *
335
+ * @defaultValue null
336
+ */
337
+ tenantId: string | null;
338
+ /**
339
+ * The {@link Auth} instance's settings.
340
+ *
341
+ * @remarks
342
+ * This is used to edit/read configuration related options such as app verification mode for
343
+ * phone authentication.
344
+ */
345
+ readonly settings: AuthSettings;
346
+ /**
347
+ * Adds an observer for changes to the user's sign-in state.
348
+ *
349
+ * @remarks
350
+ * To keep the old behavior, see {@link Auth.onIdTokenChanged}.
351
+ *
352
+ * @param nextOrObserver - callback triggered on change.
353
+ * @param error - Deprecated. This callback is never triggered. Errors
354
+ * on signing in/out can be caught in promises returned from
355
+ * sign-in/sign-out functions.
356
+ * @param completed - Deprecated. This callback is never triggered.
357
+ */
358
+ onAuthStateChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
359
+ /**
360
+ * Adds a blocking callback that runs before an auth state change
361
+ * sets a new user.
362
+ *
363
+ * @param callback - callback triggered before new user value is set.
364
+ * If this throws, it blocks the user from being set.
365
+ * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
366
+ * callback throws, allowing you to undo any side effects.
367
+ */
368
+ beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
369
+ /**
370
+ * Adds an observer for changes to the signed-in user's ID token.
371
+ *
372
+ * @remarks
373
+ * This includes sign-in, sign-out, and token refresh events.
374
+ *
375
+ * @param nextOrObserver - callback triggered on change.
376
+ * @param error - Deprecated. This callback is never triggered. Errors
377
+ * on signing in/out can be caught in promises returned from
378
+ * sign-in/sign-out functions.
379
+ * @param completed - Deprecated. This callback is never triggered.
380
+ */
381
+ onIdTokenChanged(nextOrObserver: NextOrObserver<User | null>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
382
+ /**
383
+ * returns a promise that resolves immediately when the initial
384
+ * auth state is settled. When the promise resolves, the current user might be a valid user
385
+ * or `null` if the user signed out.
386
+ */
387
+ authStateReady(): Promise<void>;
388
+ /** The currently signed-in user (or null). */
389
+ readonly currentUser: User | null;
390
+ /** The current emulator configuration (or null). */
391
+ readonly emulatorConfig: EmulatorConfig | null;
392
+ /**
393
+ * Asynchronously sets the provided user as {@link Auth.currentUser} on the {@link Auth} instance.
394
+ *
395
+ * @remarks
396
+ * A new instance copy of the user provided will be made and set as currentUser.
397
+ *
398
+ * This will trigger {@link Auth.onAuthStateChanged} and {@link Auth.onIdTokenChanged} listeners
399
+ * like other sign in methods.
400
+ *
401
+ * The operation fails with an error if the user to be updated belongs to a different Firebase
402
+ * project.
403
+ *
404
+ * @param user - The new {@link User}.
405
+ */
406
+ updateCurrentUser(user: User | null): Promise<void>;
407
+ /**
408
+ * Sets the current language to the default device/browser preference.
409
+ */
410
+ useDeviceLanguage(): void;
411
+ /**
412
+ * Signs out the current user. This does not automatically revoke the user's ID token.
413
+ *
414
+ * @remarks
415
+ * This method is not supported by {@link Auth} instances created with a
416
+ * {@link @firebase/app#FirebaseServerApp}.
417
+ */
418
+ signOut(): Promise<void>;
419
+ }
420
+
421
+ /**
422
+ * Interface that represents the credentials returned by an {@link AuthProvider}.
423
+ *
424
+ * @remarks
425
+ * Implementations specify the details about each auth provider's credential requirements.
426
+ *
427
+ * @public
428
+ */
429
+ export declare class AuthCredential {
430
+ /**
431
+ * The authentication provider ID for the credential.
432
+ *
433
+ * @remarks
434
+ * For example, 'facebook.com', or 'google.com'.
435
+ */
436
+ readonly providerId: string;
437
+ /**
438
+ * The authentication sign in method for the credential.
439
+ *
440
+ * @remarks
441
+ * For example, {@link SignInMethod}.EMAIL_PASSWORD, or
442
+ * {@link SignInMethod}.EMAIL_LINK. This corresponds to the sign-in method
443
+ * identifier as returned in {@link fetchSignInMethodsForEmail}.
444
+ */
445
+ readonly signInMethod: string;
446
+ /* Excluded from this release type: __constructor */
447
+ /**
448
+ * Returns a JSON-serializable representation of this object.
449
+ *
450
+ * @returns a JSON-serializable representation of this object.
451
+ */
452
+ toJSON(): object;
453
+ /* Excluded from this release type: _getIdTokenResponse */
454
+ /* Excluded from this release type: _linkToIdToken */
455
+ /* Excluded from this release type: _getReauthenticationResolver */
456
+ }
457
+
458
+ /**
459
+ * Interface for an `Auth` error.
460
+ *
461
+ * @public
462
+ */
463
+ export declare interface AuthError extends FirebaseError {
464
+ /** Details about the Firebase Auth error. */
465
+ readonly customData: {
466
+ /** The name of the Firebase App which triggered this error. */
467
+ readonly appName: string;
468
+ /** The email address of the user's account, used for sign-in and linking. */
469
+ readonly email?: string;
470
+ /** The phone number of the user's account, used for sign-in and linking. */
471
+ readonly phoneNumber?: string;
472
+ /**
473
+ * The tenant ID being used for sign-in and linking.
474
+ *
475
+ * @remarks
476
+ * If you use {@link signInWithRedirect} to sign in,
477
+ * you have to set the tenant ID on the {@link Auth} instance again as the tenant ID is not persisted
478
+ * after redirection.
479
+ */
480
+ readonly tenantId?: string;
481
+ };
482
+ }
483
+
484
+ /* Excluded from this release type: AuthErrorCode */
485
+
486
+ /**
487
+ * A map of potential `Auth` error codes, for easier comparison with errors
488
+ * thrown by the SDK.
489
+ *
490
+ * @remarks
491
+ * Note that you can't tree-shake individual keys
492
+ * in the map, so by using the map you might substantially increase your
493
+ * bundle size.
494
+ *
495
+ * @public
496
+ */
497
+ export declare const AuthErrorCodes: {
498
+ readonly ADMIN_ONLY_OPERATION: "auth/admin-restricted-operation";
499
+ readonly ARGUMENT_ERROR: "auth/argument-error";
500
+ readonly APP_NOT_AUTHORIZED: "auth/app-not-authorized";
501
+ readonly APP_NOT_INSTALLED: "auth/app-not-installed";
502
+ readonly CAPTCHA_CHECK_FAILED: "auth/captcha-check-failed";
503
+ readonly CODE_EXPIRED: "auth/code-expired";
504
+ readonly CORDOVA_NOT_READY: "auth/cordova-not-ready";
505
+ readonly CORS_UNSUPPORTED: "auth/cors-unsupported";
506
+ readonly CREDENTIAL_ALREADY_IN_USE: "auth/credential-already-in-use";
507
+ readonly CREDENTIAL_MISMATCH: "auth/custom-token-mismatch";
508
+ readonly CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "auth/requires-recent-login";
509
+ readonly DEPENDENT_SDK_INIT_BEFORE_AUTH: "auth/dependent-sdk-initialized-before-auth";
510
+ readonly DYNAMIC_LINK_NOT_ACTIVATED: "auth/dynamic-link-not-activated";
511
+ readonly EMAIL_CHANGE_NEEDS_VERIFICATION: "auth/email-change-needs-verification";
512
+ readonly EMAIL_EXISTS: "auth/email-already-in-use";
513
+ readonly EMULATOR_CONFIG_FAILED: "auth/emulator-config-failed";
514
+ readonly EXPIRED_OOB_CODE: "auth/expired-action-code";
515
+ readonly EXPIRED_POPUP_REQUEST: "auth/cancelled-popup-request";
516
+ readonly INTERNAL_ERROR: "auth/internal-error";
517
+ readonly INVALID_API_KEY: "auth/invalid-api-key";
518
+ readonly INVALID_APP_CREDENTIAL: "auth/invalid-app-credential";
519
+ readonly INVALID_APP_ID: "auth/invalid-app-id";
520
+ readonly INVALID_AUTH: "auth/invalid-user-token";
521
+ readonly INVALID_AUTH_EVENT: "auth/invalid-auth-event";
522
+ readonly INVALID_CERT_HASH: "auth/invalid-cert-hash";
523
+ readonly INVALID_CODE: "auth/invalid-verification-code";
524
+ readonly INVALID_CONTINUE_URI: "auth/invalid-continue-uri";
525
+ readonly INVALID_CORDOVA_CONFIGURATION: "auth/invalid-cordova-configuration";
526
+ readonly INVALID_CUSTOM_TOKEN: "auth/invalid-custom-token";
527
+ readonly INVALID_DYNAMIC_LINK_DOMAIN: "auth/invalid-dynamic-link-domain";
528
+ readonly INVALID_EMAIL: "auth/invalid-email";
529
+ readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
530
+ readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
531
+ readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential";
532
+ readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
533
+ readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
534
+ readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
535
+ readonly INVALID_OAUTH_PROVIDER: "auth/invalid-oauth-provider";
536
+ readonly INVALID_OOB_CODE: "auth/invalid-action-code";
537
+ readonly INVALID_ORIGIN: "auth/unauthorized-domain";
538
+ readonly INVALID_PASSWORD: "auth/wrong-password";
539
+ readonly INVALID_PERSISTENCE: "auth/invalid-persistence-type";
540
+ readonly INVALID_PHONE_NUMBER: "auth/invalid-phone-number";
541
+ readonly INVALID_PROVIDER_ID: "auth/invalid-provider-id";
542
+ readonly INVALID_RECIPIENT_EMAIL: "auth/invalid-recipient-email";
543
+ readonly INVALID_SENDER: "auth/invalid-sender";
544
+ readonly INVALID_SESSION_INFO: "auth/invalid-verification-id";
545
+ readonly INVALID_TENANT_ID: "auth/invalid-tenant-id";
546
+ readonly MFA_INFO_NOT_FOUND: "auth/multi-factor-info-not-found";
547
+ readonly MFA_REQUIRED: "auth/multi-factor-auth-required";
548
+ readonly MISSING_ANDROID_PACKAGE_NAME: "auth/missing-android-pkg-name";
549
+ readonly MISSING_APP_CREDENTIAL: "auth/missing-app-credential";
550
+ readonly MISSING_AUTH_DOMAIN: "auth/auth-domain-config-required";
551
+ readonly MISSING_CODE: "auth/missing-verification-code";
552
+ readonly MISSING_CONTINUE_URI: "auth/missing-continue-uri";
553
+ readonly MISSING_IFRAME_START: "auth/missing-iframe-start";
554
+ readonly MISSING_IOS_BUNDLE_ID: "auth/missing-ios-bundle-id";
555
+ readonly MISSING_OR_INVALID_NONCE: "auth/missing-or-invalid-nonce";
556
+ readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info";
557
+ readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session";
558
+ readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number";
559
+ readonly MISSING_SESSION_INFO: "auth/missing-verification-id";
560
+ readonly MODULE_DESTROYED: "auth/app-deleted";
561
+ readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential";
562
+ readonly NETWORK_REQUEST_FAILED: "auth/network-request-failed";
563
+ readonly NULL_USER: "auth/null-user";
564
+ readonly NO_AUTH_EVENT: "auth/no-auth-event";
565
+ readonly NO_SUCH_PROVIDER: "auth/no-such-provider";
566
+ readonly OPERATION_NOT_ALLOWED: "auth/operation-not-allowed";
567
+ readonly OPERATION_NOT_SUPPORTED: "auth/operation-not-supported-in-this-environment";
568
+ readonly POPUP_BLOCKED: "auth/popup-blocked";
569
+ readonly POPUP_CLOSED_BY_USER: "auth/popup-closed-by-user";
570
+ readonly PROVIDER_ALREADY_LINKED: "auth/provider-already-linked";
571
+ readonly QUOTA_EXCEEDED: "auth/quota-exceeded";
572
+ readonly REDIRECT_CANCELLED_BY_USER: "auth/redirect-cancelled-by-user";
573
+ readonly REDIRECT_OPERATION_PENDING: "auth/redirect-operation-pending";
574
+ readonly REJECTED_CREDENTIAL: "auth/rejected-credential";
575
+ readonly SECOND_FACTOR_ALREADY_ENROLLED: "auth/second-factor-already-in-use";
576
+ readonly SECOND_FACTOR_LIMIT_EXCEEDED: "auth/maximum-second-factor-count-exceeded";
577
+ readonly TENANT_ID_MISMATCH: "auth/tenant-id-mismatch";
578
+ readonly TIMEOUT: "auth/timeout";
579
+ readonly TOKEN_EXPIRED: "auth/user-token-expired";
580
+ readonly TOO_MANY_ATTEMPTS_TRY_LATER: "auth/too-many-requests";
581
+ readonly UNAUTHORIZED_DOMAIN: "auth/unauthorized-continue-uri";
582
+ readonly UNSUPPORTED_FIRST_FACTOR: "auth/unsupported-first-factor";
583
+ readonly UNSUPPORTED_PERSISTENCE: "auth/unsupported-persistence-type";
584
+ readonly UNSUPPORTED_TENANT_OPERATION: "auth/unsupported-tenant-operation";
585
+ readonly UNVERIFIED_EMAIL: "auth/unverified-email";
586
+ readonly USER_CANCELLED: "auth/user-cancelled";
587
+ readonly USER_DELETED: "auth/user-not-found";
588
+ readonly USER_DISABLED: "auth/user-disabled";
589
+ readonly USER_MISMATCH: "auth/user-mismatch";
590
+ readonly USER_SIGNED_OUT: "auth/user-signed-out";
591
+ readonly WEAK_PASSWORD: "auth/weak-password";
592
+ readonly WEB_STORAGE_UNSUPPORTED: "auth/web-storage-unsupported";
593
+ readonly ALREADY_INITIALIZED: "auth/already-initialized";
594
+ readonly RECAPTCHA_NOT_ENABLED: "auth/recaptcha-not-enabled";
595
+ readonly MISSING_RECAPTCHA_TOKEN: "auth/missing-recaptcha-token";
596
+ readonly INVALID_RECAPTCHA_TOKEN: "auth/invalid-recaptcha-token";
597
+ readonly INVALID_RECAPTCHA_ACTION: "auth/invalid-recaptcha-action";
598
+ readonly MISSING_CLIENT_TYPE: "auth/missing-client-type";
599
+ readonly MISSING_RECAPTCHA_VERSION: "auth/missing-recaptcha-version";
600
+ readonly INVALID_RECAPTCHA_VERSION: "auth/invalid-recaptcha-version";
601
+ readonly INVALID_REQ_TYPE: "auth/invalid-req-type";
602
+ };
603
+
604
+ /**
605
+ * A mapping of error codes to error messages.
606
+ *
607
+ * @remarks
608
+ *
609
+ * While error messages are useful for debugging (providing verbose textual
610
+ * context around what went wrong), these strings take up a lot of space in the
611
+ * compiled code. When deploying code in production, using {@link prodErrorMap}
612
+ * will save you roughly 10k compressed/gzipped over {@link debugErrorMap}. You
613
+ * can select the error map during initialization:
614
+ *
615
+ * ```javascript
616
+ * initializeAuth(app, {errorMap: debugErrorMap})
617
+ * ```
618
+ *
619
+ * When initializing Auth, {@link prodErrorMap} is default.
620
+ *
621
+ * @public
622
+ */
623
+ export declare interface AuthErrorMap {
624
+ }
625
+
626
+ /* Excluded from this release type: AuthErrorParams */
627
+
628
+ /* Excluded from this release type: AuthEvent */
629
+
630
+ /* Excluded from this release type: AuthEventConsumer */
631
+
632
+ declare interface AuthEventError extends Error {
633
+ code: string;
634
+ message: string;
635
+ }
636
+
637
+ /* Excluded from this release type: AuthEventType */
638
+
639
+ /* Excluded from this release type: AuthInternal */
640
+
641
+ declare class AuthPopup {
642
+ readonly window: Window | null;
643
+ associatedEvent: string | null;
644
+ constructor(window: Window | null);
645
+ close(): void;
646
+ }
647
+
648
+ /**
649
+ * Interface that represents an auth provider, used to facilitate creating {@link AuthCredential}.
650
+ *
651
+ * @public
652
+ */
653
+ export declare interface AuthProvider {
654
+ /**
655
+ * Provider for which credentials can be constructed.
656
+ */
657
+ readonly providerId: string;
658
+ }
659
+
660
+ /**
661
+ * Interface representing an {@link Auth} instance's settings.
662
+ *
663
+ * @remarks Currently used for enabling/disabling app verification for phone Auth testing.
664
+ *
665
+ * @public
666
+ */
667
+ export declare interface AuthSettings {
668
+ /**
669
+ * When set, this property disables app verification for the purpose of testing phone
670
+ * authentication. For this property to take effect, it needs to be set before rendering a
671
+ * reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is
672
+ * useful for manual testing during development or for automated integration tests.
673
+ *
674
+ * In order to use this feature, you will need to
675
+ * {@link https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers | whitelist your phone number}
676
+ * via the Firebase Console.
677
+ *
678
+ * The default value is false (app verification is enabled).
679
+ */
680
+ appVerificationDisabledForTesting: boolean;
681
+ }
682
+
683
+ /**
684
+ * MFA Info as returned by the API.
685
+ */
686
+ declare interface BaseMfaEnrollment {
687
+ mfaEnrollmentId: string;
688
+ enrolledAt: number;
689
+ displayName?: string;
690
+ }
691
+
692
+ /**
693
+ * Common code to all OAuth providers. This is separate from the
694
+ * {@link OAuthProvider} so that child providers (like
695
+ * {@link GoogleAuthProvider}) don't inherit the `credential` instance method.
696
+ * Instead, they rely on a static `credential` method.
697
+ */
698
+ declare abstract class BaseOAuthProvider extends FederatedAuthProvider implements AuthProvider {
699
+ /* Excluded from this release type: scopes */
700
+ /**
701
+ * Add an OAuth scope to the credential.
702
+ *
703
+ * @param scope - Provider OAuth scope to add.
704
+ */
705
+ addScope(scope: string): AuthProvider;
706
+ /**
707
+ * Retrieve the current list of OAuth scopes.
708
+ */
709
+ getScopes(): string[];
710
+ }
711
+
712
+ /**
713
+ * Adds a blocking callback that runs before an auth state change
714
+ * sets a new user.
715
+ *
716
+ * @param auth - The {@link Auth} instance.
717
+ * @param callback - callback triggered before new user value is set.
718
+ * If this throws, it blocks the user from being set.
719
+ * @param onAbort - callback triggered if a later `beforeAuthStateChanged()`
720
+ * callback throws, allowing you to undo any side effects.
721
+ */
722
+ export declare function beforeAuthStateChanged(auth: Auth, callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
723
+
724
+ /**
725
+ * An implementation of {@link Persistence} of type `LOCAL` using `localStorage`
726
+ * for the underlying storage.
727
+ *
728
+ * @public
729
+ */
730
+ export declare const browserLocalPersistence: Persistence;
731
+
732
+ /**
733
+ * An implementation of {@link Persistence} of `SESSION` using `sessionStorage`
734
+ * for the underlying storage.
735
+ *
736
+ * @public
737
+ */
738
+ export declare const browserSessionPersistence: Persistence;
739
+
740
+ /**
741
+ * Checks a verification code sent to the user by email or other out-of-band mechanism.
742
+ *
743
+ * @returns metadata about the code.
744
+ *
745
+ * @param auth - The {@link Auth} instance.
746
+ * @param oobCode - A verification code sent to the user.
747
+ *
748
+ * @public
749
+ */
750
+ export declare function checkActionCode(auth: Auth, oobCode: string): Promise<ActionCodeInfo>;
751
+
752
+ /* Excluded from this release type: ClientPlatform */
753
+ export { CompleteFn }
754
+
755
+ /**
756
+ * Interface representing the `Auth` config.
757
+ *
758
+ * @public
759
+ */
760
+ export declare interface Config {
761
+ /**
762
+ * The API Key used to communicate with the Firebase Auth backend.
763
+ */
764
+ apiKey: string;
765
+ /**
766
+ * The host at which the Firebase Auth backend is running.
767
+ */
768
+ apiHost: string;
769
+ /**
770
+ * The scheme used to communicate with the Firebase Auth backend.
771
+ */
772
+ apiScheme: string;
773
+ /**
774
+ * The host at which the Secure Token API is running.
775
+ */
776
+ tokenApiHost: string;
777
+ /**
778
+ * The SDK Client Version.
779
+ */
780
+ sdkClientVersion: string;
781
+ /**
782
+ * The domain at which the web widgets are hosted (provided via Firebase Config).
783
+ */
784
+ authDomain?: string;
785
+ }
786
+
787
+ /* Excluded from this release type: ConfigInternal */
788
+
789
+ /**
790
+ * A result from a phone number sign-in, link, or reauthenticate call.
791
+ *
792
+ * @public
793
+ */
794
+ export declare interface ConfirmationResult {
795
+ /**
796
+ * The phone number authentication operation's verification ID.
797
+ *
798
+ * @remarks
799
+ * This can be used along with the verification code to initialize a
800
+ * {@link PhoneAuthCredential}.
801
+ */
802
+ readonly verificationId: string;
803
+ /**
804
+ * Finishes a phone number sign-in, link, or reauthentication.
805
+ *
806
+ * @example
807
+ * ```javascript
808
+ * const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier);
809
+ * // Obtain verificationCode from the user.
810
+ * const userCredential = await confirmationResult.confirm(verificationCode);
811
+ * ```
812
+ *
813
+ * @param verificationCode - The code that was sent to the user's mobile device.
814
+ */
815
+ confirm(verificationCode: string): Promise<UserCredential>;
816
+ }
817
+
818
+ /**
819
+ * Completes the password reset process, given a confirmation code and new password.
820
+ *
821
+ * @param auth - The {@link Auth} instance.
822
+ * @param oobCode - A confirmation code sent to the user.
823
+ * @param newPassword - The new password.
824
+ *
825
+ * @public
826
+ */
827
+ export declare function confirmPasswordReset(auth: Auth, oobCode: string, newPassword: string): Promise<void>;
828
+
829
+ /**
830
+ * Changes the {@link Auth} instance to communicate with the Firebase Auth Emulator, instead of production
831
+ * Firebase Auth services.
832
+ *
833
+ * @remarks
834
+ * This must be called synchronously immediately following the first call to
835
+ * {@link initializeAuth}. Do not use with production credentials as emulator
836
+ * traffic is not encrypted.
837
+ *
838
+ *
839
+ * @example
840
+ * ```javascript
841
+ * connectAuthEmulator(auth, 'http://127.0.0.1:9099', { disableWarnings: true });
842
+ * ```
843
+ *
844
+ * @param auth - The {@link Auth} instance.
845
+ * @param url - The URL at which the emulator is running (eg, 'http://localhost:9099').
846
+ * @param options - Optional. `options.disableWarnings` defaults to `false`. Set it to
847
+ * `true` to disable the warning banner attached to the DOM.
848
+ *
849
+ * @public
850
+ */
851
+ export declare function connectAuthEmulator(auth: Auth, url: string, options?: {
852
+ disableWarnings: boolean;
853
+ }): void;
854
+
855
+ /**
856
+ * An implementation of {@link PopupRedirectResolver} suitable for Cordova
857
+ * based applications.
858
+ *
859
+ * @public
860
+ */
861
+ export declare const cordovaPopupRedirectResolver: PopupRedirectResolver;
862
+
863
+ /**
864
+ * Creates a new user account associated with the specified email address and password.
865
+ *
866
+ * @remarks
867
+ * On successful creation of the user account, this user will also be signed in to your application.
868
+ *
869
+ * User account creation can fail if the account already exists or the password is invalid.
870
+ *
871
+ * This method is not supported on {@link Auth} instances created with a
872
+ * {@link @firebase/app#FirebaseServerApp}.
873
+ *
874
+ * Note: The email address acts as a unique identifier for the user and enables an email-based
875
+ * password reset. This function will create a new user account and set the initial user password.
876
+ *
877
+ * @param auth - The {@link Auth} instance.
878
+ * @param email - The user's email address.
879
+ * @param password - The user's chosen password.
880
+ *
881
+ * @public
882
+ */
883
+ export declare function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;
884
+
885
+ /**
886
+ * Map of OAuth Custom Parameters.
887
+ *
888
+ * @public
889
+ */
890
+ export declare type CustomParameters = Record<string, string>;
891
+
892
+ /**
893
+ * A verbose error map with detailed descriptions for most error codes.
894
+ *
895
+ * See discussion at {@link AuthErrorMap}
896
+ *
897
+ * @public
898
+ */
899
+ export declare const debugErrorMap: AuthErrorMap;
900
+
901
+ /**
902
+ * Deletes and signs out the user.
903
+ *
904
+ * @remarks
905
+ * Important: this is a security-sensitive operation that requires the user to have recently
906
+ * signed in. If this requirement isn't met, ask the user to authenticate again and then call
907
+ * {@link reauthenticateWithCredential}.
908
+ *
909
+ * @param user - The user.
910
+ *
911
+ * @public
912
+ */
913
+ export declare function deleteUser(user: User): Promise<void>;
914
+
915
+ /**
916
+ * The dependencies that can be used to initialize an {@link Auth} instance.
917
+ *
918
+ * @remarks
919
+ *
920
+ * The modular SDK enables tree shaking by allowing explicit declarations of
921
+ * dependencies. For example, a web app does not need to include code that
922
+ * enables Cordova redirect sign in. That functionality is therefore split into
923
+ * {@link browserPopupRedirectResolver} and
924
+ * {@link cordovaPopupRedirectResolver}. The dependencies object is how Auth is
925
+ * configured to reduce bundle sizes.
926
+ *
927
+ * There are two ways to initialize an {@link Auth} instance: {@link getAuth} and
928
+ * {@link initializeAuth}. `getAuth` initializes everything using
929
+ * platform-specific configurations, while `initializeAuth` takes a
930
+ * `Dependencies` object directly, giving you more control over what is used.
931
+ *
932
+ * @public
933
+ */
934
+ export declare interface Dependencies {
935
+ /**
936
+ * Which {@link Persistence} to use. If this is an array, the first
937
+ * `Persistence` that the device supports is used. The SDK searches for an
938
+ * existing account in order and, if one is found in a secondary
939
+ * `Persistence`, the account is moved to the primary `Persistence`.
940
+ *
941
+ * If no persistence is provided, the SDK falls back on
942
+ * {@link inMemoryPersistence}.
943
+ */
944
+ persistence?: Persistence | Persistence[];
945
+ /**
946
+ * The {@link PopupRedirectResolver} to use. This value depends on the
947
+ * platform. Options are {@link browserPopupRedirectResolver} and
948
+ * {@link cordovaPopupRedirectResolver}. This field is optional if neither
949
+ * {@link signInWithPopup} or {@link signInWithRedirect} are being used.
950
+ */
951
+ popupRedirectResolver?: PopupRedirectResolver;
952
+ /**
953
+ * Which {@link AuthErrorMap} to use.
954
+ */
955
+ errorMap?: AuthErrorMap;
956
+ }
957
+
958
+ /**
959
+ * Interface that represents the credentials returned by {@link EmailAuthProvider} for
960
+ * {@link ProviderId}.PASSWORD
961
+ *
962
+ * @remarks
963
+ * Covers both {@link SignInMethod}.EMAIL_PASSWORD and
964
+ * {@link SignInMethod}.EMAIL_LINK.
965
+ *
966
+ * @public
967
+ */
968
+ export declare class EmailAuthCredential extends AuthCredential {
969
+ /* Excluded from this release type: _email */
970
+ /* Excluded from this release type: _password */
971
+ /* Excluded from this release type: _tenantId */
972
+ /* Excluded from this release type: __constructor */
973
+ /* Excluded from this release type: _fromEmailAndPassword */
974
+ /* Excluded from this release type: _fromEmailAndCode */
975
+ /** {@inheritdoc AuthCredential.toJSON} */
976
+ toJSON(): object;
977
+ /**
978
+ * Static method to deserialize a JSON representation of an object into an {@link AuthCredential}.
979
+ *
980
+ * @param json - Either `object` or the stringified representation of the object. When string is
981
+ * provided, `JSON.parse` would be called first.
982
+ *
983
+ * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
984
+ */
985
+ static fromJSON(json: object | string): EmailAuthCredential | null;
986
+ /* Excluded from this release type: _getIdTokenResponse */
987
+ /* Excluded from this release type: _linkToIdToken */
988
+ /* Excluded from this release type: _getReauthenticationResolver */
989
+ }
990
+
991
+ /**
992
+ * Provider for generating {@link EmailAuthCredential}.
993
+ *
994
+ * @public
995
+ */
996
+ export declare class EmailAuthProvider implements AuthProvider {
997
+ /**
998
+ * Always set to {@link ProviderId}.PASSWORD, even for email link.
999
+ */
1000
+ static readonly PROVIDER_ID: 'password';
1001
+ /**
1002
+ * Always set to {@link SignInMethod}.EMAIL_PASSWORD.
1003
+ */
1004
+ static readonly EMAIL_PASSWORD_SIGN_IN_METHOD: 'password';
1005
+ /**
1006
+ * Always set to {@link SignInMethod}.EMAIL_LINK.
1007
+ */
1008
+ static readonly EMAIL_LINK_SIGN_IN_METHOD: 'emailLink';
1009
+ /**
1010
+ * Always set to {@link ProviderId}.PASSWORD, even for email link.
1011
+ */
1012
+ readonly providerId: "password";
1013
+ /**
1014
+ * Initialize an {@link AuthCredential} using an email and password.
1015
+ *
1016
+ * @example
1017
+ * ```javascript
1018
+ * const authCredential = EmailAuthProvider.credential(email, password);
1019
+ * const userCredential = await signInWithCredential(auth, authCredential);
1020
+ * ```
1021
+ *
1022
+ * @example
1023
+ * ```javascript
1024
+ * const userCredential = await signInWithEmailAndPassword(auth, email, password);
1025
+ * ```
1026
+ *
1027
+ * @param email - Email address.
1028
+ * @param password - User account password.
1029
+ * @returns The auth provider credential.
1030
+ */
1031
+ static credential(email: string, password: string): EmailAuthCredential;
1032
+ /**
1033
+ * Initialize an {@link AuthCredential} using an email and an email link after a sign in with
1034
+ * email link operation.
1035
+ *
1036
+ * @example
1037
+ * ```javascript
1038
+ * const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
1039
+ * const userCredential = await signInWithCredential(auth, authCredential);
1040
+ * ```
1041
+ *
1042
+ * @example
1043
+ * ```javascript
1044
+ * await sendSignInLinkToEmail(auth, email);
1045
+ * // Obtain emailLink from user.
1046
+ * const userCredential = await signInWithEmailLink(auth, email, emailLink);
1047
+ * ```
1048
+ *
1049
+ * @param auth - The {@link Auth} instance used to verify the link.
1050
+ * @param email - Email address.
1051
+ * @param emailLink - Sign-in email link.
1052
+ * @returns - The auth provider credential.
1053
+ */
1054
+ static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;
1055
+ }
1056
+
1057
+ /**
1058
+ * Configuration of Firebase Authentication Emulator.
1059
+ * @public
1060
+ */
1061
+ export declare interface EmulatorConfig {
1062
+ /**
1063
+ * The protocol used to communicate with the emulator ("http"/"https").
1064
+ */
1065
+ readonly protocol: string;
1066
+ /**
1067
+ * The hostname of the emulator, which may be a domain ("localhost"), IPv4 address ("127.0.0.1")
1068
+ * or quoted IPv6 address ("[::1]").
1069
+ */
1070
+ readonly host: string;
1071
+ /**
1072
+ * The port of the emulator, or null if port isn't specified (i.e. protocol default).
1073
+ */
1074
+ readonly port: number | null;
1075
+ /**
1076
+ * The emulator-specific options.
1077
+ */
1078
+ readonly options: {
1079
+ /**
1080
+ * Whether the warning banner attached to the DOM was disabled.
1081
+ */
1082
+ readonly disableWarnings: boolean;
1083
+ };
1084
+ }
1085
+
1086
+ declare const enum EnforcementState {
1087
+ ENFORCE = "ENFORCE",
1088
+ AUDIT = "AUDIT",
1089
+ OFF = "OFF",
1090
+ ENFORCEMENT_STATE_UNSPECIFIED = "ENFORCEMENT_STATE_UNSPECIFIED"
1091
+ }
1092
+ export { ErrorFn }
1093
+
1094
+ /* Excluded from this release type: EventManager */
1095
+
1096
+ /**
1097
+ * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.FACEBOOK.
1098
+ *
1099
+ * @example
1100
+ * ```javascript
1101
+ * // Sign in using a redirect.
1102
+ * const provider = new FacebookAuthProvider();
1103
+ * // Start a sign in process for an unauthenticated user.
1104
+ * provider.addScope('user_birthday');
1105
+ * await signInWithRedirect(auth, provider);
1106
+ * // This will trigger a full page redirect away from your app
1107
+ *
1108
+ * // After returning from the redirect when your app initializes you can obtain the result
1109
+ * const result = await getRedirectResult(auth);
1110
+ * if (result) {
1111
+ * // This is the signed-in user
1112
+ * const user = result.user;
1113
+ * // This gives you a Facebook Access Token.
1114
+ * const credential = FacebookAuthProvider.credentialFromResult(result);
1115
+ * const token = credential.accessToken;
1116
+ * }
1117
+ * ```
1118
+ *
1119
+ * @example
1120
+ * ```javascript
1121
+ * // Sign in using a popup.
1122
+ * const provider = new FacebookAuthProvider();
1123
+ * provider.addScope('user_birthday');
1124
+ * const result = await signInWithPopup(auth, provider);
1125
+ *
1126
+ * // The signed-in user info.
1127
+ * const user = result.user;
1128
+ * // This gives you a Facebook Access Token.
1129
+ * const credential = FacebookAuthProvider.credentialFromResult(result);
1130
+ * const token = credential.accessToken;
1131
+ * ```
1132
+ *
1133
+ * @public
1134
+ */
1135
+ export declare class FacebookAuthProvider extends BaseOAuthProvider {
1136
+ /** Always set to {@link SignInMethod}.FACEBOOK. */
1137
+ static readonly FACEBOOK_SIGN_IN_METHOD: 'facebook.com';
1138
+ /** Always set to {@link ProviderId}.FACEBOOK. */
1139
+ static readonly PROVIDER_ID: 'facebook.com';
1140
+ constructor();
1141
+ /**
1142
+ * Creates a credential for Facebook.
1143
+ *
1144
+ * @example
1145
+ * ```javascript
1146
+ * // `event` from the Facebook auth.authResponseChange callback.
1147
+ * const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
1148
+ * const result = await signInWithCredential(credential);
1149
+ * ```
1150
+ *
1151
+ * @param accessToken - Facebook access token.
1152
+ */
1153
+ static credential(accessToken: string): OAuthCredential;
1154
+ /**
1155
+ * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
1156
+ *
1157
+ * @param userCredential - The user credential.
1158
+ */
1159
+ static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
1160
+ /**
1161
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
1162
+ * thrown during a sign-in, link, or reauthenticate operation.
1163
+ *
1164
+ * @param userCredential - The user credential.
1165
+ */
1166
+ static credentialFromError(error: FirebaseError): OAuthCredential | null;
1167
+ private static credentialFromTaggedObject;
1168
+ }
1169
+
1170
+ /**
1171
+ * An enum of factors that may be used for multifactor authentication.
1172
+ *
1173
+ * @public
1174
+ */
1175
+ export declare const FactorId: {
1176
+ /** Phone as second factor */
1177
+ readonly PHONE: "phone";
1178
+ readonly TOTP: "totp";
1179
+ };
1180
+
1181
+ /**
1182
+ * The base class for all Federated providers (OAuth (including OIDC), SAML).
1183
+ *
1184
+ * This class is not meant to be instantiated directly.
1185
+ *
1186
+ * @public
1187
+ */
1188
+ declare abstract class FederatedAuthProvider implements AuthProvider {
1189
+ readonly providerId: string;
1190
+ /* Excluded from this release type: defaultLanguageCode */
1191
+ /* Excluded from this release type: customParameters */
1192
+ /**
1193
+ * Constructor for generic OAuth providers.
1194
+ *
1195
+ * @param providerId - Provider for which credentials should be generated.
1196
+ */
1197
+ constructor(providerId: string);
1198
+ /**
1199
+ * Set the language gode.
1200
+ *
1201
+ * @param languageCode - language code
1202
+ */
1203
+ setDefaultLanguage(languageCode: string | null): void;
1204
+ /**
1205
+ * Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in
1206
+ * operations.
1207
+ *
1208
+ * @remarks
1209
+ * For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,
1210
+ * `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.
1211
+ *
1212
+ * @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.
1213
+ */
1214
+ setCustomParameters(customOAuthParameters: CustomParameters): AuthProvider;
1215
+ /**
1216
+ * Retrieve the current list of {@link CustomParameters}.
1217
+ */
1218
+ getCustomParameters(): CustomParameters;
1219
+ }
1220
+
1221
+ /**
1222
+ * Gets the list of possible sign in methods for the given email address. This method returns an
1223
+ * empty list when
1224
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
1225
+ * is enabled, irrespective of the number of authentication methods available for the given email.
1226
+ *
1227
+ * @remarks
1228
+ * This is useful to differentiate methods of sign-in for the same provider, eg.
1229
+ * {@link EmailAuthProvider} which has 2 methods of sign-in,
1230
+ * {@link SignInMethod}.EMAIL_PASSWORD and
1231
+ * {@link SignInMethod}.EMAIL_LINK.
1232
+ *
1233
+ * @param auth - The {@link Auth} instance.
1234
+ * @param email - The user's email address.
1235
+ *
1236
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
1237
+ * Learn more in the Identity Platform documentation for
1238
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}.
1239
+ * @public
1240
+ */
1241
+ export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
1242
+
1243
+ declare interface FinalizeMfaResponse {
1244
+ idToken: string;
1245
+ refreshToken: string;
1246
+ }
1247
+
1248
+ /* Excluded from this release type: GenericAuthErrorParams */
1249
+
1250
+ /**
1251
+ * Extracts provider specific {@link AdditionalUserInfo} for the given credential.
1252
+ *
1253
+ * @param userCredential - The user credential.
1254
+ *
1255
+ * @public
1256
+ */
1257
+ export declare function getAdditionalUserInfo(userCredential: UserCredential): AdditionalUserInfo | null;
1258
+
1259
+ export declare function getAuth(app?: FirebaseApp): Auth;
1260
+
1261
+ /**
1262
+ * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
1263
+ *
1264
+ * @remarks
1265
+ * Returns the current token if it has not expired or if it will not expire in the next five
1266
+ * minutes. Otherwise, this will refresh the token and return a new one.
1267
+ *
1268
+ * @param user - The user.
1269
+ * @param forceRefresh - Force refresh regardless of token expiration.
1270
+ *
1271
+ * @public
1272
+ */
1273
+ export declare function getIdToken(user: User, forceRefresh?: boolean): Promise<string>;
1274
+
1275
+ /**
1276
+ * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
1277
+ *
1278
+ * @remarks
1279
+ * Returns the current token if it has not expired or if it will not expire in the next five
1280
+ * minutes. Otherwise, this will refresh the token and return a new one.
1281
+ *
1282
+ * @param user - The user.
1283
+ * @param forceRefresh - Force refresh regardless of token expiration.
1284
+ *
1285
+ * @public
1286
+ */
1287
+ export declare function getIdTokenResult(user: User, forceRefresh?: boolean): Promise<IdTokenResult>;
1288
+
1289
+ /**
1290
+ * Provides a {@link MultiFactorResolver} suitable for completion of a
1291
+ * multi-factor flow.
1292
+ *
1293
+ * @param auth - The {@link Auth} instance.
1294
+ * @param error - The {@link MultiFactorError} raised during a sign-in, or
1295
+ * reauthentication operation.
1296
+ *
1297
+ * @public
1298
+ */
1299
+ export declare function getMultiFactorResolver(auth: Auth, error: MultiFactorError): MultiFactorResolver;
1300
+
1301
+ declare interface GetRecaptchaConfigResponse {
1302
+ recaptchaKey: string;
1303
+ recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
1304
+ }
1305
+
1306
+ /**
1307
+ * Returns a {@link UserCredential} from the redirect-based sign-in flow.
1308
+ *
1309
+ * @remarks
1310
+ * If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
1311
+ * error. If no redirect operation was called, returns `null`.
1312
+ *
1313
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
1314
+ * {@link @firebase/app#FirebaseServerApp}.
1315
+ *
1316
+ * @example
1317
+ * ```javascript
1318
+ * // Sign in using a redirect.
1319
+ * const provider = new FacebookAuthProvider();
1320
+ * // You can add additional scopes to the provider:
1321
+ * provider.addScope('user_birthday');
1322
+ * // Start a sign in process for an unauthenticated user.
1323
+ * await signInWithRedirect(auth, provider);
1324
+ * // This will trigger a full page redirect away from your app
1325
+ *
1326
+ * // After returning from the redirect when your app initializes you can obtain the result
1327
+ * const result = await getRedirectResult(auth);
1328
+ * if (result) {
1329
+ * // This is the signed-in user
1330
+ * const user = result.user;
1331
+ * // This gives you a Facebook Access Token.
1332
+ * const credential = provider.credentialFromResult(auth, result);
1333
+ * const token = credential.accessToken;
1334
+ * }
1335
+ * // As this API can be used for sign-in, linking and reauthentication,
1336
+ * // check the operationType to determine what triggered this redirect
1337
+ * // operation.
1338
+ * const operationType = result.operationType;
1339
+ * ```
1340
+ *
1341
+ * @param auth - The {@link Auth} instance.
1342
+ * @param resolver - An instance of {@link PopupRedirectResolver}, optional
1343
+ * if already supplied to {@link initializeAuth} or provided by {@link getAuth}.
1344
+ *
1345
+ * @public
1346
+ */
1347
+ export declare function getRedirectResult(auth: Auth, resolver?: PopupRedirectResolver): Promise<UserCredential | null>;
1348
+
1349
+ /**
1350
+ * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GITHUB.
1351
+ *
1352
+ * @remarks
1353
+ * GitHub requires an OAuth 2.0 redirect, so you can either handle the redirect directly, or use
1354
+ * the {@link signInWithPopup} handler:
1355
+ *
1356
+ * @example
1357
+ * ```javascript
1358
+ * // Sign in using a redirect.
1359
+ * const provider = new GithubAuthProvider();
1360
+ * // Start a sign in process for an unauthenticated user.
1361
+ * provider.addScope('repo');
1362
+ * await signInWithRedirect(auth, provider);
1363
+ * // This will trigger a full page redirect away from your app
1364
+ *
1365
+ * // After returning from the redirect when your app initializes you can obtain the result
1366
+ * const result = await getRedirectResult(auth);
1367
+ * if (result) {
1368
+ * // This is the signed-in user
1369
+ * const user = result.user;
1370
+ * // This gives you a Github Access Token.
1371
+ * const credential = GithubAuthProvider.credentialFromResult(result);
1372
+ * const token = credential.accessToken;
1373
+ * }
1374
+ * ```
1375
+ *
1376
+ * @example
1377
+ * ```javascript
1378
+ * // Sign in using a popup.
1379
+ * const provider = new GithubAuthProvider();
1380
+ * provider.addScope('repo');
1381
+ * const result = await signInWithPopup(auth, provider);
1382
+ *
1383
+ * // The signed-in user info.
1384
+ * const user = result.user;
1385
+ * // This gives you a Github Access Token.
1386
+ * const credential = GithubAuthProvider.credentialFromResult(result);
1387
+ * const token = credential.accessToken;
1388
+ * ```
1389
+ * @public
1390
+ */
1391
+ export declare class GithubAuthProvider extends BaseOAuthProvider {
1392
+ /** Always set to {@link SignInMethod}.GITHUB. */
1393
+ static readonly GITHUB_SIGN_IN_METHOD: 'github.com';
1394
+ /** Always set to {@link ProviderId}.GITHUB. */
1395
+ static readonly PROVIDER_ID: 'github.com';
1396
+ constructor();
1397
+ /**
1398
+ * Creates a credential for Github.
1399
+ *
1400
+ * @param accessToken - Github access token.
1401
+ */
1402
+ static credential(accessToken: string): OAuthCredential;
1403
+ /**
1404
+ * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
1405
+ *
1406
+ * @param userCredential - The user credential.
1407
+ */
1408
+ static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
1409
+ /**
1410
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
1411
+ * thrown during a sign-in, link, or reauthenticate operation.
1412
+ *
1413
+ * @param userCredential - The user credential.
1414
+ */
1415
+ static credentialFromError(error: FirebaseError): OAuthCredential | null;
1416
+ private static credentialFromTaggedObject;
1417
+ }
1418
+
1419
+ /**
1420
+ * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.GOOGLE.
1421
+ *
1422
+ * @example
1423
+ * ```javascript
1424
+ * // Sign in using a redirect.
1425
+ * const provider = new GoogleAuthProvider();
1426
+ * // Start a sign in process for an unauthenticated user.
1427
+ * provider.addScope('profile');
1428
+ * provider.addScope('email');
1429
+ * await signInWithRedirect(auth, provider);
1430
+ * // This will trigger a full page redirect away from your app
1431
+ *
1432
+ * // After returning from the redirect when your app initializes you can obtain the result
1433
+ * const result = await getRedirectResult(auth);
1434
+ * if (result) {
1435
+ * // This is the signed-in user
1436
+ * const user = result.user;
1437
+ * // This gives you a Google Access Token.
1438
+ * const credential = GoogleAuthProvider.credentialFromResult(result);
1439
+ * const token = credential.accessToken;
1440
+ * }
1441
+ * ```
1442
+ *
1443
+ * @example
1444
+ * ```javascript
1445
+ * // Sign in using a popup.
1446
+ * const provider = new GoogleAuthProvider();
1447
+ * provider.addScope('profile');
1448
+ * provider.addScope('email');
1449
+ * const result = await signInWithPopup(auth, provider);
1450
+ *
1451
+ * // The signed-in user info.
1452
+ * const user = result.user;
1453
+ * // This gives you a Google Access Token.
1454
+ * const credential = GoogleAuthProvider.credentialFromResult(result);
1455
+ * const token = credential.accessToken;
1456
+ * ```
1457
+ *
1458
+ * @public
1459
+ */
1460
+ export declare class GoogleAuthProvider extends BaseOAuthProvider {
1461
+ /** Always set to {@link SignInMethod}.GOOGLE. */
1462
+ static readonly GOOGLE_SIGN_IN_METHOD: 'google.com';
1463
+ /** Always set to {@link ProviderId}.GOOGLE. */
1464
+ static readonly PROVIDER_ID: 'google.com';
1465
+ constructor();
1466
+ /**
1467
+ * Creates a credential for Google. At least one of ID token and access token is required.
1468
+ *
1469
+ * @example
1470
+ * ```javascript
1471
+ * // \`googleUser\` from the onsuccess Google Sign In callback.
1472
+ * const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
1473
+ * const result = await signInWithCredential(credential);
1474
+ * ```
1475
+ *
1476
+ * @param idToken - Google ID token.
1477
+ * @param accessToken - Google access token.
1478
+ */
1479
+ static credential(idToken?: string | null, accessToken?: string | null): OAuthCredential;
1480
+ /**
1481
+ * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
1482
+ *
1483
+ * @param userCredential - The user credential.
1484
+ */
1485
+ static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
1486
+ /**
1487
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
1488
+ * thrown during a sign-in, link, or reauthenticate operation.
1489
+ *
1490
+ * @param userCredential - The user credential.
1491
+ */
1492
+ static credentialFromError(error: FirebaseError): OAuthCredential | null;
1493
+ private static credentialFromTaggedObject;
1494
+ }
1495
+
1496
+ /**
1497
+ * Raw encoded JWT
1498
+ *
1499
+ */
1500
+ declare type IdToken = string;
1501
+
1502
+ /* Excluded from this release type: IdTokenMfaResponse */
1503
+
1504
+ /* Excluded from this release type: IdTokenResponse */
1505
+
1506
+ /* Excluded from this release type: IdTokenResponseKind */
1507
+
1508
+ /**
1509
+ * Interface representing ID token result obtained from {@link User.getIdTokenResult}.
1510
+ *
1511
+ * @remarks
1512
+ * `IdTokenResult` contains the ID token JWT string and other helper properties for getting different data
1513
+ * associated with the token as well as all the decoded payload claims.
1514
+ *
1515
+ * Note that these claims are not to be trusted as they are parsed client side. Only server side
1516
+ * verification can guarantee the integrity of the token claims.
1517
+ *
1518
+ * @public
1519
+ */
1520
+ export declare interface IdTokenResult {
1521
+ /**
1522
+ * The authentication time formatted as a UTC string.
1523
+ *
1524
+ * @remarks
1525
+ * This is the time the user authenticated (signed in) and not the time the token was refreshed.
1526
+ */
1527
+ authTime: string;
1528
+ /** The ID token expiration time formatted as a UTC string. */
1529
+ expirationTime: string;
1530
+ /** The ID token issuance time formatted as a UTC string. */
1531
+ issuedAtTime: string;
1532
+ /**
1533
+ * The sign-in provider through which the ID token was obtained (anonymous, custom, phone,
1534
+ * password, etc).
1535
+ *
1536
+ * @remarks
1537
+ * Note, this does not map to provider IDs.
1538
+ */
1539
+ signInProvider: string | null;
1540
+ /**
1541
+ * The type of second factor associated with this session, provided the user was multi-factor
1542
+ * authenticated (eg. phone, etc).
1543
+ */
1544
+ signInSecondFactor: string | null;
1545
+ /** The Firebase Auth ID token JWT string. */
1546
+ token: string;
1547
+ /**
1548
+ * The entire payload claims of the ID token including the standard reserved claims as well as
1549
+ * the custom claims.
1550
+ */
1551
+ claims: ParsedToken;
1552
+ }
1553
+
1554
+ /**
1555
+ * An implementation of {@link Persistence} of type `LOCAL` using `indexedDB`
1556
+ * for the underlying storage.
1557
+ *
1558
+ * @public
1559
+ */
1560
+ export declare const indexedDBLocalPersistence: Persistence;
1561
+
1562
+ /**
1563
+ * Initializes an {@link Auth} instance with fine-grained control over
1564
+ * {@link Dependencies}.
1565
+ *
1566
+ * @remarks
1567
+ *
1568
+ * This function allows more control over the {@link Auth} instance than
1569
+ * {@link getAuth}. `getAuth` uses platform-specific defaults to supply
1570
+ * the {@link Dependencies}. In general, `getAuth` is the easiest way to
1571
+ * initialize Auth and works for most use cases. Use `initializeAuth` if you
1572
+ * need control over which persistence layer is used, or to minimize bundle
1573
+ * size if you're not using either `signInWithPopup` or `signInWithRedirect`.
1574
+ *
1575
+ * For example, if your app only uses anonymous accounts and you only want
1576
+ * accounts saved for the current session, initialize `Auth` with:
1577
+ *
1578
+ * ```js
1579
+ * const auth = initializeAuth(app, {
1580
+ * persistence: browserSessionPersistence,
1581
+ * popupRedirectResolver: undefined,
1582
+ * });
1583
+ * ```
1584
+ *
1585
+ * @public
1586
+ */
1587
+ export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth;
1588
+
1589
+ /**
1590
+ * Loads the reCAPTCHA configuration into the `Auth` instance.
1591
+ *
1592
+ * @remarks
1593
+ * This will load the reCAPTCHA config, which indicates whether the reCAPTCHA
1594
+ * verification flow should be triggered for each auth provider, into the
1595
+ * current Auth session.
1596
+ *
1597
+ * If initializeRecaptchaConfig() is not invoked, the auth flow will always start
1598
+ * without reCAPTCHA verification. If the provider is configured to require reCAPTCHA
1599
+ * verification, the SDK will transparently load the reCAPTCHA config and restart the
1600
+ * auth flows.
1601
+ *
1602
+ * Thus, by calling this optional method, you will reduce the latency of future auth flows.
1603
+ * Loading the reCAPTCHA config early will also enhance the signal collected by reCAPTCHA.
1604
+ *
1605
+ * This method does not work in a Node.js environment.
1606
+ *
1607
+ * @example
1608
+ * ```javascript
1609
+ * initializeRecaptchaConfig(auth);
1610
+ * ```
1611
+ *
1612
+ * @param auth - The {@link Auth} instance.
1613
+ *
1614
+ * @public
1615
+ */
1616
+ export declare function initializeRecaptchaConfig(auth: Auth): Promise<void>;
1617
+
1618
+ /**
1619
+ * An implementation of {@link Persistence} of type 'NONE'.
1620
+ *
1621
+ * @public
1622
+ */
1623
+ export declare const inMemoryPersistence: Persistence;
1624
+
1625
+ /**
1626
+ * Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
1627
+ *
1628
+ * @param auth - The {@link Auth} instance.
1629
+ * @param emailLink - The link sent to the user's email address.
1630
+ *
1631
+ * @public
1632
+ */
1633
+ export declare function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;
1634
+
1635
+ /**
1636
+ * Links the user account with the given credentials.
1637
+ *
1638
+ * @remarks
1639
+ * An {@link AuthProvider} can be used to generate the credential.
1640
+ *
1641
+ * @param user - The user.
1642
+ * @param credential - The auth credential.
1643
+ *
1644
+ * @public
1645
+ */
1646
+ export declare function linkWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;
1647
+
1648
+ export declare function linkWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>;
1649
+
1650
+ /**
1651
+ * MfaEnrollment can be any subtype of BaseMfaEnrollment, currently only PhoneMfaEnrollment and TotpMfaEnrollment are supported.
1652
+ */
1653
+ declare type MfaEnrollment = PhoneMfaEnrollment | TotpMfaEnrollment;
1654
+
1655
+ /**
1656
+ * The {@link MultiFactorUser} corresponding to the user.
1657
+ *
1658
+ * @remarks
1659
+ * This is used to access all multi-factor properties and operations related to the user.
1660
+ *
1661
+ * @param user - The user.
1662
+ *
1663
+ * @public
1664
+ */
1665
+ export declare function multiFactor(user: User): MultiFactorUser;
1666
+
1667
+ /**
1668
+ * The base class for asserting ownership of a second factor.
1669
+ *
1670
+ * @remarks
1671
+ * This is used to facilitate enrollment of a second factor on an existing user or sign-in of a
1672
+ * user who already verified the first factor.
1673
+ *
1674
+ * @public
1675
+ */
1676
+ export declare interface MultiFactorAssertion {
1677
+ /** The identifier of the second factor. */
1678
+ readonly factorId: (typeof FactorId)[keyof typeof FactorId];
1679
+ }
1680
+
1681
+ /**
1682
+ * The error thrown when the user needs to provide a second factor to sign in successfully.
1683
+ *
1684
+ * @remarks
1685
+ * The error code for this error is `auth/multi-factor-auth-required`.
1686
+ *
1687
+ * @example
1688
+ * ```javascript
1689
+ * let resolver;
1690
+ * let multiFactorHints;
1691
+ *
1692
+ * signInWithEmailAndPassword(auth, email, password)
1693
+ * .then((result) => {
1694
+ * // User signed in. No 2nd factor challenge is needed.
1695
+ * })
1696
+ * .catch((error) => {
1697
+ * if (error.code == 'auth/multi-factor-auth-required') {
1698
+ * resolver = getMultiFactorResolver(auth, error);
1699
+ * multiFactorHints = resolver.hints;
1700
+ * } else {
1701
+ * // Handle other errors.
1702
+ * }
1703
+ * });
1704
+ *
1705
+ * // Obtain a multiFactorAssertion by verifying the second factor.
1706
+ *
1707
+ * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
1708
+ * ```
1709
+ *
1710
+ * @public
1711
+ */
1712
+ export declare interface MultiFactorError extends AuthError {
1713
+ /** Details about the MultiFactorError. */
1714
+ readonly customData: AuthError['customData'] & {
1715
+ /**
1716
+ * The type of operation (sign-in, linking, or re-authentication) that raised the error.
1717
+ */
1718
+ readonly operationType: (typeof OperationType)[keyof typeof OperationType];
1719
+ };
1720
+ }
1721
+
1722
+ /**
1723
+ * A structure containing the information of a second factor entity.
1724
+ *
1725
+ * @public
1726
+ */
1727
+ export declare interface MultiFactorInfo {
1728
+ /** The multi-factor enrollment ID. */
1729
+ readonly uid: string;
1730
+ /** The user friendly name of the current second factor. */
1731
+ readonly displayName?: string | null;
1732
+ /** The enrollment date of the second factor formatted as a UTC string. */
1733
+ readonly enrollmentTime: string;
1734
+ /** The identifier of the second factor. */
1735
+ readonly factorId: (typeof FactorId)[keyof typeof FactorId];
1736
+ }
1737
+
1738
+ /**
1739
+ * The class used to facilitate recovery from {@link MultiFactorError} when a user needs to
1740
+ * provide a second factor to sign in.
1741
+ *
1742
+ * @example
1743
+ * ```javascript
1744
+ * let resolver;
1745
+ * let multiFactorHints;
1746
+ *
1747
+ * signInWithEmailAndPassword(auth, email, password)
1748
+ * .then((result) => {
1749
+ * // User signed in. No 2nd factor challenge is needed.
1750
+ * })
1751
+ * .catch((error) => {
1752
+ * if (error.code == 'auth/multi-factor-auth-required') {
1753
+ * resolver = getMultiFactorResolver(auth, error);
1754
+ * // Show UI to let user select second factor.
1755
+ * multiFactorHints = resolver.hints;
1756
+ * } else {
1757
+ * // Handle other errors.
1758
+ * }
1759
+ * });
1760
+ *
1761
+ * // The enrolled second factors that can be used to complete
1762
+ * // sign-in are returned in the `MultiFactorResolver.hints` list.
1763
+ * // UI needs to be presented to allow the user to select a second factor
1764
+ * // from that list.
1765
+ *
1766
+ * const selectedHint = // ; selected from multiFactorHints
1767
+ * const phoneAuthProvider = new PhoneAuthProvider(auth);
1768
+ * const phoneInfoOptions = {
1769
+ * multiFactorHint: selectedHint,
1770
+ * session: resolver.session
1771
+ * };
1772
+ * const verificationId = phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
1773
+ * // Store `verificationId` and show UI to let user enter verification code.
1774
+ *
1775
+ * // UI to enter verification code and continue.
1776
+ * // Continue button click handler
1777
+ * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
1778
+ * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
1779
+ * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
1780
+ * ```
1781
+ *
1782
+ * @public
1783
+ */
1784
+ export declare interface MultiFactorResolver {
1785
+ /**
1786
+ * The list of hints for the second factors needed to complete the sign-in for the current
1787
+ * session.
1788
+ */
1789
+ readonly hints: MultiFactorInfo[];
1790
+ /**
1791
+ * The session identifier for the current sign-in flow, which can be used to complete the second
1792
+ * factor sign-in.
1793
+ */
1794
+ readonly session: MultiFactorSession;
1795
+ /**
1796
+ * A helper function to help users complete sign in with a second factor using an
1797
+ * {@link MultiFactorAssertion} confirming the user successfully completed the second factor
1798
+ * challenge.
1799
+ *
1800
+ * @example
1801
+ * ```javascript
1802
+ * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
1803
+ * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
1804
+ * const userCredential = await resolver.resolveSignIn(multiFactorAssertion);
1805
+ * ```
1806
+ *
1807
+ * @param assertion - The multi-factor assertion to resolve sign-in with.
1808
+ * @returns The promise that resolves with the user credential object.
1809
+ */
1810
+ resolveSignIn(assertion: MultiFactorAssertion): Promise<UserCredential>;
1811
+ }
1812
+
1813
+ /**
1814
+ * An interface defining the multi-factor session object used for enrolling a second factor on a
1815
+ * user or helping sign in an enrolled user with a second factor.
1816
+ *
1817
+ * @public
1818
+ */
1819
+ export declare interface MultiFactorSession {
1820
+ }
1821
+
1822
+ /**
1823
+ * An interface that defines the multi-factor related properties and operations pertaining
1824
+ * to a {@link User}.
1825
+ *
1826
+ * @public
1827
+ */
1828
+ export declare interface MultiFactorUser {
1829
+ /** Returns a list of the user's enrolled second factors. */
1830
+ readonly enrolledFactors: MultiFactorInfo[];
1831
+ /**
1832
+ * Returns the session identifier for a second factor enrollment operation. This is used to
1833
+ * identify the user trying to enroll a second factor.
1834
+ *
1835
+ * @example
1836
+ * ```javascript
1837
+ * const multiFactorUser = multiFactor(auth.currentUser);
1838
+ * const multiFactorSession = await multiFactorUser.getSession();
1839
+ *
1840
+ * // Send verification code.
1841
+ * const phoneAuthProvider = new PhoneAuthProvider(auth);
1842
+ * const phoneInfoOptions = {
1843
+ * phoneNumber: phoneNumber,
1844
+ * session: multiFactorSession
1845
+ * };
1846
+ * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
1847
+ *
1848
+ * // Obtain verification code from user.
1849
+ * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
1850
+ * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
1851
+ * await multiFactorUser.enroll(multiFactorAssertion);
1852
+ * ```
1853
+ *
1854
+ * @returns The promise that resolves with the {@link MultiFactorSession}.
1855
+ */
1856
+ getSession(): Promise<MultiFactorSession>;
1857
+ /**
1858
+ *
1859
+ * Enrolls a second factor as identified by the {@link MultiFactorAssertion} for the
1860
+ * user.
1861
+ *
1862
+ * @remarks
1863
+ * On resolution, the user tokens are updated to reflect the change in the JWT payload.
1864
+ * Accepts an additional display name parameter used to identify the second factor to the end
1865
+ * user. Recent re-authentication is required for this operation to succeed. On successful
1866
+ * enrollment, existing Firebase sessions (refresh tokens) are revoked. When a new factor is
1867
+ * enrolled, an email notification is sent to the user’s email.
1868
+ *
1869
+ * @example
1870
+ * ```javascript
1871
+ * const multiFactorUser = multiFactor(auth.currentUser);
1872
+ * const multiFactorSession = await multiFactorUser.getSession();
1873
+ *
1874
+ * // Send verification code.
1875
+ * const phoneAuthProvider = new PhoneAuthProvider(auth);
1876
+ * const phoneInfoOptions = {
1877
+ * phoneNumber: phoneNumber,
1878
+ * session: multiFactorSession
1879
+ * };
1880
+ * const verificationId = await phoneAuthProvider.verifyPhoneNumber(phoneInfoOptions, appVerifier);
1881
+ *
1882
+ * // Obtain verification code from user.
1883
+ * const phoneAuthCredential = PhoneAuthProvider.credential(verificationId, verificationCode);
1884
+ * const multiFactorAssertion = PhoneMultiFactorGenerator.assertion(phoneAuthCredential);
1885
+ * await multiFactorUser.enroll(multiFactorAssertion);
1886
+ * // Second factor enrolled.
1887
+ * ```
1888
+ *
1889
+ * @param assertion - The multi-factor assertion to enroll with.
1890
+ * @param displayName - The display name of the second factor.
1891
+ */
1892
+ enroll(assertion: MultiFactorAssertion, displayName?: string | null): Promise<void>;
1893
+ /**
1894
+ * Unenrolls the specified second factor.
1895
+ *
1896
+ * @remarks
1897
+ * To specify the factor to remove, pass a {@link MultiFactorInfo} object (retrieved from
1898
+ * {@link MultiFactorUser.enrolledFactors}) or the
1899
+ * factor's UID string. Sessions are not revoked when the account is unenrolled. An email
1900
+ * notification is likely to be sent to the user notifying them of the change. Recent
1901
+ * re-authentication is required for this operation to succeed. When an existing factor is
1902
+ * unenrolled, an email notification is sent to the user’s email.
1903
+ *
1904
+ * @example
1905
+ * ```javascript
1906
+ * const multiFactorUser = multiFactor(auth.currentUser);
1907
+ * // Present user the option to choose which factor to unenroll.
1908
+ * await multiFactorUser.unenroll(multiFactorUser.enrolledFactors[i])
1909
+ * ```
1910
+ *
1911
+ * @param option - The multi-factor option to unenroll.
1912
+ * @returns - A `Promise` which resolves when the unenroll operation is complete.
1913
+ */
1914
+ unenroll(option: MultiFactorInfo | string): Promise<void>;
1915
+ }
1916
+
1917
+ declare type MutableUserInfo = {
1918
+ -readonly [K in keyof UserInfo]: UserInfo[K];
1919
+ };
1920
+ export { NextFn }
1921
+
1922
+ /**
1923
+ * Type definition for an event callback.
1924
+ *
1925
+ * @privateRemarks TODO(avolkovi): should we consolidate with Subscribe<T> since we're changing the API anyway?
1926
+ *
1927
+ * @public
1928
+ */
1929
+ export declare type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;
1930
+
1931
+ /**
1932
+ * Represents the OAuth credentials returned by an {@link OAuthProvider}.
1933
+ *
1934
+ * @remarks
1935
+ * Implementations specify the details about each auth provider's credential requirements.
1936
+ *
1937
+ * @public
1938
+ */
1939
+ export declare class OAuthCredential extends AuthCredential {
1940
+ /**
1941
+ * The OAuth ID token associated with the credential if it belongs to an OIDC provider,
1942
+ * such as `google.com`.
1943
+ * @readonly
1944
+ */
1945
+ idToken?: string;
1946
+ /**
1947
+ * The OAuth access token associated with the credential if it belongs to an
1948
+ * {@link OAuthProvider}, such as `facebook.com`, `twitter.com`, etc.
1949
+ * @readonly
1950
+ */
1951
+ accessToken?: string;
1952
+ /**
1953
+ * The OAuth access token secret associated with the credential if it belongs to an OAuth 1.0
1954
+ * provider, such as `twitter.com`.
1955
+ * @readonly
1956
+ */
1957
+ secret?: string;
1958
+ private nonce?;
1959
+ private pendingToken;
1960
+ /* Excluded from this release type: _fromParams */
1961
+ /** {@inheritdoc AuthCredential.toJSON} */
1962
+ toJSON(): object;
1963
+ /**
1964
+ * Static method to deserialize a JSON representation of an object into an
1965
+ * {@link AuthCredential}.
1966
+ *
1967
+ * @param json - Input can be either Object or the stringified representation of the object.
1968
+ * When string is provided, JSON.parse would be called first.
1969
+ *
1970
+ * @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
1971
+ */
1972
+ static fromJSON(json: string | object): OAuthCredential | null;
1973
+ /* Excluded from this release type: _getIdTokenResponse */
1974
+ /* Excluded from this release type: _linkToIdToken */
1975
+ /* Excluded from this release type: _getReauthenticationResolver */
1976
+ private buildRequest;
1977
+ }
1978
+
1979
+ /**
1980
+ * Defines the options for initializing an {@link OAuthCredential}.
1981
+ *
1982
+ * @remarks
1983
+ * For ID tokens with nonce claim, the raw nonce has to also be provided.
1984
+ *
1985
+ * @public
1986
+ */
1987
+ export declare interface OAuthCredentialOptions {
1988
+ /**
1989
+ * The OAuth ID token used to initialize the {@link OAuthCredential}.
1990
+ */
1991
+ idToken?: string;
1992
+ /**
1993
+ * The OAuth access token used to initialize the {@link OAuthCredential}.
1994
+ */
1995
+ accessToken?: string;
1996
+ /**
1997
+ * The raw nonce associated with the ID token.
1998
+ *
1999
+ * @remarks
2000
+ * It is required when an ID token with a nonce field is provided. The SHA-256 hash of the
2001
+ * raw nonce must match the nonce field in the ID token.
2002
+ */
2003
+ rawNonce?: string;
2004
+ }
2005
+
2006
+ declare interface OAuthCredentialParams {
2007
+ idToken?: string | null;
2008
+ accessToken?: string | null;
2009
+ oauthToken?: string;
2010
+ secret?: string;
2011
+ oauthTokenSecret?: string;
2012
+ nonce?: string;
2013
+ pendingToken?: string;
2014
+ providerId: string;
2015
+ signInMethod: string;
2016
+ }
2017
+
2018
+ /**
2019
+ * Provider for generating generic {@link OAuthCredential}.
2020
+ *
2021
+ * @example
2022
+ * ```javascript
2023
+ * // Sign in using a redirect.
2024
+ * const provider = new OAuthProvider('google.com');
2025
+ * // Start a sign in process for an unauthenticated user.
2026
+ * provider.addScope('profile');
2027
+ * provider.addScope('email');
2028
+ * await signInWithRedirect(auth, provider);
2029
+ * // This will trigger a full page redirect away from your app
2030
+ *
2031
+ * // After returning from the redirect when your app initializes you can obtain the result
2032
+ * const result = await getRedirectResult(auth);
2033
+ * if (result) {
2034
+ * // This is the signed-in user
2035
+ * const user = result.user;
2036
+ * // This gives you a OAuth Access Token for the provider.
2037
+ * const credential = provider.credentialFromResult(auth, result);
2038
+ * const token = credential.accessToken;
2039
+ * }
2040
+ * ```
2041
+ *
2042
+ * @example
2043
+ * ```javascript
2044
+ * // Sign in using a popup.
2045
+ * const provider = new OAuthProvider('google.com');
2046
+ * provider.addScope('profile');
2047
+ * provider.addScope('email');
2048
+ * const result = await signInWithPopup(auth, provider);
2049
+ *
2050
+ * // The signed-in user info.
2051
+ * const user = result.user;
2052
+ * // This gives you a OAuth Access Token for the provider.
2053
+ * const credential = provider.credentialFromResult(auth, result);
2054
+ * const token = credential.accessToken;
2055
+ * ```
2056
+ * @public
2057
+ */
2058
+ export declare class OAuthProvider extends BaseOAuthProvider {
2059
+ /**
2060
+ * Creates an {@link OAuthCredential} from a JSON string or a plain object.
2061
+ * @param json - A plain object or a JSON string
2062
+ */
2063
+ static credentialFromJSON(json: object | string): OAuthCredential;
2064
+ /**
2065
+ * Creates a {@link OAuthCredential} from a generic OAuth provider's access token or ID token.
2066
+ *
2067
+ * @remarks
2068
+ * The raw nonce is required when an ID token with a nonce field is provided. The SHA-256 hash of
2069
+ * the raw nonce must match the nonce field in the ID token.
2070
+ *
2071
+ * @example
2072
+ * ```javascript
2073
+ * // `googleUser` from the onsuccess Google Sign In callback.
2074
+ * // Initialize a generate OAuth provider with a `google.com` providerId.
2075
+ * const provider = new OAuthProvider('google.com');
2076
+ * const credential = provider.credential({
2077
+ * idToken: googleUser.getAuthResponse().id_token,
2078
+ * });
2079
+ * const result = await signInWithCredential(credential);
2080
+ * ```
2081
+ *
2082
+ * @param params - Either the options object containing the ID token, access token and raw nonce
2083
+ * or the ID token string.
2084
+ */
2085
+ credential(params: OAuthCredentialOptions): OAuthCredential;
2086
+ /** An internal credential method that accepts more permissive options */
2087
+ private _credential;
2088
+ /**
2089
+ * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
2090
+ *
2091
+ * @param userCredential - The user credential.
2092
+ */
2093
+ static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
2094
+ /**
2095
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
2096
+ * thrown during a sign-in, link, or reauthenticate operation.
2097
+ *
2098
+ * @param userCredential - The user credential.
2099
+ */
2100
+ static credentialFromError(error: FirebaseError): OAuthCredential | null;
2101
+ private static oauthCredentialFromTaggedObject;
2102
+ }
2103
+
2104
+ /**
2105
+ * Adds an observer for changes to the user's sign-in state.
2106
+ *
2107
+ * @remarks
2108
+ * To keep the old behavior, see {@link onIdTokenChanged}.
2109
+ *
2110
+ * @param auth - The {@link Auth} instance.
2111
+ * @param nextOrObserver - callback triggered on change.
2112
+ * @param error - Deprecated. This callback is never triggered. Errors
2113
+ * on signing in/out can be caught in promises returned from
2114
+ * sign-in/sign-out functions.
2115
+ * @param completed - Deprecated. This callback is never triggered.
2116
+ *
2117
+ * @public
2118
+ */
2119
+ export declare function onAuthStateChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
2120
+
2121
+ /**
2122
+ * Adds an observer for changes to the signed-in user's ID token.
2123
+ *
2124
+ * @remarks
2125
+ * This includes sign-in, sign-out, and token refresh events.
2126
+ * This will not be triggered automatically upon ID token expiration. Use {@link User.getIdToken} to refresh the ID token.
2127
+ *
2128
+ * @param auth - The {@link Auth} instance.
2129
+ * @param nextOrObserver - callback triggered on change.
2130
+ * @param error - Deprecated. This callback is never triggered. Errors
2131
+ * on signing in/out can be caught in promises returned from
2132
+ * sign-in/sign-out functions.
2133
+ * @param completed - Deprecated. This callback is never triggered.
2134
+ *
2135
+ * @public
2136
+ */
2137
+ export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
2138
+
2139
+ /**
2140
+ * Enumeration of supported operation types.
2141
+ *
2142
+ * @public
2143
+ */
2144
+ export declare const OperationType: {
2145
+ /** Operation involving linking an additional provider to an already signed-in user. */
2146
+ readonly LINK: "link";
2147
+ /** Operation involving using a provider to reauthenticate an already signed-in user. */
2148
+ readonly REAUTHENTICATE: "reauthenticate";
2149
+ /** Operation involving signing in a user. */
2150
+ readonly SIGN_IN: "signIn";
2151
+ };
2152
+
2153
+ /**
2154
+ * Parses the email action link string and returns an {@link ActionCodeURL} if
2155
+ * the link is valid, otherwise returns null.
2156
+ *
2157
+ * @public
2158
+ */
2159
+ export declare function parseActionCodeURL(link: string): ActionCodeURL | null;
2160
+
2161
+ /**
2162
+ * Interface representing a parsed ID token.
2163
+ *
2164
+ * @privateRemarks TODO(avolkovi): consolidate with parsed_token in implementation.
2165
+ *
2166
+ * @public
2167
+ */
2168
+ export declare interface ParsedToken {
2169
+ /** Expiration time of the token. */
2170
+ 'exp'?: string;
2171
+ /** UID of the user. */
2172
+ 'sub'?: string;
2173
+ /** Time at which authentication was performed. */
2174
+ 'auth_time'?: string;
2175
+ /** Issuance time of the token. */
2176
+ 'iat'?: string;
2177
+ /** Firebase specific claims, containing the provider(s) used to authenticate the user. */
2178
+ 'firebase'?: {
2179
+ 'sign_in_provider'?: string;
2180
+ 'sign_in_second_factor'?: string;
2181
+ 'identities'?: Record<string, string>;
2182
+ };
2183
+ /** Map of any additional custom claims. */
2184
+ [key: string]: unknown;
2185
+ }
2186
+
2187
+ /**
2188
+ * A structure specifying password policy requirements.
2189
+ *
2190
+ * @public
2191
+ */
2192
+ export declare interface PasswordPolicy {
2193
+ /**
2194
+ * Requirements enforced by this password policy.
2195
+ */
2196
+ readonly customStrengthOptions: {
2197
+ /**
2198
+ * Minimum password length, or undefined if not configured.
2199
+ */
2200
+ readonly minPasswordLength?: number;
2201
+ /**
2202
+ * Maximum password length, or undefined if not configured.
2203
+ */
2204
+ readonly maxPasswordLength?: number;
2205
+ /**
2206
+ * Whether the password should contain a lowercase letter, or undefined if not configured.
2207
+ */
2208
+ readonly containsLowercaseLetter?: boolean;
2209
+ /**
2210
+ * Whether the password should contain an uppercase letter, or undefined if not configured.
2211
+ */
2212
+ readonly containsUppercaseLetter?: boolean;
2213
+ /**
2214
+ * Whether the password should contain a numeric character, or undefined if not configured.
2215
+ */
2216
+ readonly containsNumericCharacter?: boolean;
2217
+ /**
2218
+ * Whether the password should contain a non-alphanumeric character, or undefined if not configured.
2219
+ */
2220
+ readonly containsNonAlphanumericCharacter?: boolean;
2221
+ };
2222
+ /**
2223
+ * List of characters that are considered non-alphanumeric during validation.
2224
+ */
2225
+ readonly allowedNonAlphanumericCharacters: string;
2226
+ /**
2227
+ * The enforcement state of the policy. Can be 'OFF' or 'ENFORCE'.
2228
+ */
2229
+ readonly enforcementState: string;
2230
+ /**
2231
+ * Whether existing passwords must meet the policy.
2232
+ */
2233
+ readonly forceUpgradeOnSignin: boolean;
2234
+ }
2235
+
2236
+ /* Excluded from this release type: PasswordPolicyCustomStrengthOptions */
2237
+
2238
+ /* Excluded from this release type: PasswordPolicyInternal */
2239
+
2240
+ /**
2241
+ * A structure indicating which password policy requirements were met or violated and what the
2242
+ * requirements are.
2243
+ *
2244
+ * @public
2245
+ */
2246
+ export declare interface PasswordValidationStatus {
2247
+ /**
2248
+ * Whether the password meets all requirements.
2249
+ */
2250
+ readonly isValid: boolean;
2251
+ /**
2252
+ * Whether the password meets the minimum password length, or undefined if not required.
2253
+ */
2254
+ readonly meetsMinPasswordLength?: boolean;
2255
+ /**
2256
+ * Whether the password meets the maximum password length, or undefined if not required.
2257
+ */
2258
+ readonly meetsMaxPasswordLength?: boolean;
2259
+ /**
2260
+ * Whether the password contains a lowercase letter, or undefined if not required.
2261
+ */
2262
+ readonly containsLowercaseLetter?: boolean;
2263
+ /**
2264
+ * Whether the password contains an uppercase letter, or undefined if not required.
2265
+ */
2266
+ readonly containsUppercaseLetter?: boolean;
2267
+ /**
2268
+ * Whether the password contains a numeric character, or undefined if not required.
2269
+ */
2270
+ readonly containsNumericCharacter?: boolean;
2271
+ /**
2272
+ * Whether the password contains a non-alphanumeric character, or undefined if not required.
2273
+ */
2274
+ readonly containsNonAlphanumericCharacter?: boolean;
2275
+ /**
2276
+ * The policy used to validate the password.
2277
+ */
2278
+ readonly passwordPolicy: PasswordPolicy;
2279
+ }
2280
+
2281
+ declare type PersistedBlob = Record<string, unknown>;
2282
+
2283
+ /**
2284
+ * An interface covering the possible persistence mechanism types.
2285
+ *
2286
+ * @public
2287
+ */
2288
+ export declare interface Persistence {
2289
+ /**
2290
+ * Type of Persistence.
2291
+ * - 'SESSION' is used for temporary persistence such as `sessionStorage`.
2292
+ * - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`.
2293
+ * - 'NONE' is used for in-memory, or no persistence.
2294
+ */
2295
+ readonly type: 'SESSION' | 'LOCAL' | 'NONE';
2296
+ }
2297
+
2298
+ /**
2299
+ * Represents the credentials returned by {@link PhoneAuthProvider}.
2300
+ *
2301
+ * @public
2302
+ */
2303
+ export declare class PhoneAuthCredential extends AuthCredential {
2304
+ private readonly params;
2305
+ private constructor();
2306
+ /* Excluded from this release type: _fromVerification */
2307
+ /* Excluded from this release type: _fromTokenResponse */
2308
+ /* Excluded from this release type: _getIdTokenResponse */
2309
+ /* Excluded from this release type: _linkToIdToken */
2310
+ /* Excluded from this release type: _getReauthenticationResolver */
2311
+ /* Excluded from this release type: _makeVerificationRequest */
2312
+ /** {@inheritdoc AuthCredential.toJSON} */
2313
+ toJSON(): object;
2314
+ /** Generates a phone credential based on a plain object or a JSON string. */
2315
+ static fromJSON(json: object | string): PhoneAuthCredential | null;
2316
+ }
2317
+
2318
+ /**
2319
+ * The information required to verify the ownership of a phone number.
2320
+ *
2321
+ * @remarks
2322
+ * The information that's required depends on whether you are doing single-factor sign-in,
2323
+ * multi-factor enrollment or multi-factor sign-in.
2324
+ *
2325
+ * @public
2326
+ */
2327
+ export declare type PhoneInfoOptions = PhoneSingleFactorInfoOptions | PhoneMultiFactorEnrollInfoOptions | PhoneMultiFactorSignInInfoOptions;
2328
+
2329
+ /**
2330
+ * An MFA provided by SMS verification.
2331
+ */
2332
+ declare interface PhoneMfaEnrollment extends BaseMfaEnrollment {
2333
+ phoneInfo: string;
2334
+ }
2335
+
2336
+ /**
2337
+ * The class for asserting ownership of a phone second factor. Provided by
2338
+ * {@link PhoneMultiFactorGenerator.assertion}.
2339
+ *
2340
+ * @public
2341
+ */
2342
+ export declare interface PhoneMultiFactorAssertion extends MultiFactorAssertion {
2343
+ }
2344
+
2345
+ /**
2346
+ * Options used for enrolling a second factor.
2347
+ *
2348
+ * @public
2349
+ */
2350
+ export declare interface PhoneMultiFactorEnrollInfoOptions {
2351
+ /** Phone number to send a verification code to. */
2352
+ phoneNumber: string;
2353
+ /** The {@link MultiFactorSession} obtained via {@link MultiFactorUser.getSession}. */
2354
+ session: MultiFactorSession;
2355
+ }
2356
+
2357
+ /**
2358
+ * The subclass of the {@link MultiFactorInfo} interface for phone number
2359
+ * second factors. The `factorId` of this second factor is {@link FactorId}.PHONE.
2360
+ * @public
2361
+ */
2362
+ export declare interface PhoneMultiFactorInfo extends MultiFactorInfo {
2363
+ /** The phone number associated with the current second factor. */
2364
+ readonly phoneNumber: string;
2365
+ }
2366
+
2367
+ /**
2368
+ * Options used for signing in with a second factor.
2369
+ *
2370
+ * @public
2371
+ */
2372
+ export declare interface PhoneMultiFactorSignInInfoOptions {
2373
+ /**
2374
+ * The {@link MultiFactorInfo} obtained via {@link MultiFactorResolver.hints}.
2375
+ *
2376
+ * One of `multiFactorHint` or `multiFactorUid` is required.
2377
+ */
2378
+ multiFactorHint?: MultiFactorInfo;
2379
+ /**
2380
+ * The uid of the second factor.
2381
+ *
2382
+ * One of `multiFactorHint` or `multiFactorUid` is required.
2383
+ */
2384
+ multiFactorUid?: string;
2385
+ /** The {@link MultiFactorSession} obtained via {@link MultiFactorResolver.session}. */
2386
+ session: MultiFactorSession;
2387
+ }
2388
+
2389
+ /* Excluded from this release type: PhoneOrOauthTokenResponse */
2390
+
2391
+ /**
2392
+ * Options used for single-factor sign-in.
2393
+ *
2394
+ * @public
2395
+ */
2396
+ export declare interface PhoneSingleFactorInfoOptions {
2397
+ /** Phone number to send a verification code to. */
2398
+ phoneNumber: string;
2399
+ }
2400
+
2401
+ /**
2402
+ * A resolver used for handling DOM specific operations like {@link signInWithPopup}
2403
+ * or {@link signInWithRedirect}.
2404
+ *
2405
+ * @public
2406
+ */
2407
+ export declare interface PopupRedirectResolver {
2408
+ }
2409
+
2410
+ /* Excluded from this release type: PopupRedirectResolverInternal */
2411
+
2412
+ /**
2413
+ * A minimal error map with all verbose error messages stripped.
2414
+ *
2415
+ * See discussion at {@link AuthErrorMap}
2416
+ *
2417
+ * @public
2418
+ */
2419
+ export declare const prodErrorMap: AuthErrorMap;
2420
+
2421
+ /**
2422
+ * Enumeration of supported providers.
2423
+ *
2424
+ * @public
2425
+ */
2426
+ export declare const ProviderId: {
2427
+ /** Facebook provider ID */
2428
+ readonly FACEBOOK: "facebook.com";
2429
+ /** GitHub provider ID */
2430
+ readonly GITHUB: "github.com";
2431
+ /** Google provider ID */
2432
+ readonly GOOGLE: "google.com";
2433
+ /** Password provider */
2434
+ readonly PASSWORD: "password";
2435
+ /** Phone provider */
2436
+ readonly PHONE: "phone";
2437
+ /** Twitter provider ID */
2438
+ readonly TWITTER: "twitter.com";
2439
+ };
2440
+
2441
+ /* Excluded from this release type: ProviderId_2 */
2442
+
2443
+ declare interface ProviderUserInfo {
2444
+ providerId: string;
2445
+ rawId?: string;
2446
+ email?: string;
2447
+ displayName?: string;
2448
+ photoUrl?: string;
2449
+ phoneNumber?: string;
2450
+ }
2451
+
2452
+ /**
2453
+ * Interface for a supplied `AsyncStorage`.
2454
+ *
2455
+ * @public
2456
+ */
2457
+ export declare interface ReactNativeAsyncStorage {
2458
+ /**
2459
+ * Persist an item in storage.
2460
+ *
2461
+ * @param key - storage key.
2462
+ * @param value - storage value.
2463
+ */
2464
+ setItem(key: string, value: string): Promise<void>;
2465
+ /**
2466
+ * Retrieve an item from storage.
2467
+ *
2468
+ * @param key - storage key.
2469
+ */
2470
+ getItem(key: string): Promise<string | null>;
2471
+ /**
2472
+ * Remove an item from storage.
2473
+ *
2474
+ * @param key - storage key.
2475
+ */
2476
+ removeItem(key: string): Promise<void>;
2477
+ }
2478
+
2479
+ /**
2480
+ * Re-authenticates a user using a fresh credential.
2481
+ *
2482
+ * @remarks
2483
+ * Use before operations such as {@link updatePassword} that require tokens from recent sign-in
2484
+ * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
2485
+ * or a `TOKEN_EXPIRED` error.
2486
+ *
2487
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
2488
+ * created with a {@link @firebase/app#FirebaseServerApp}.
2489
+ *
2490
+ * @param user - The user.
2491
+ * @param credential - The auth credential.
2492
+ *
2493
+ * @public
2494
+ */
2495
+ export declare function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;
2496
+
2497
+ export declare function reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>;
2498
+
2499
+ declare class RecaptchaConfig {
2500
+ /**
2501
+ * The reCAPTCHA site key.
2502
+ */
2503
+ siteKey: string;
2504
+ /**
2505
+ * The list of providers and their enablement status for reCAPTCHA Enterprise.
2506
+ */
2507
+ recaptchaEnforcementState: RecaptchaEnforcementProviderState[];
2508
+ constructor(response: GetRecaptchaConfigResponse);
2509
+ /**
2510
+ * Returns the reCAPTCHA Enterprise enforcement state for the given provider.
2511
+ *
2512
+ * @param providerStr - The provider whose enforcement state is to be returned.
2513
+ * @returns The reCAPTCHA Enterprise enforcement state for the given provider.
2514
+ */
2515
+ getProviderEnforcementState(providerStr: string): EnforcementState | null;
2516
+ /**
2517
+ * Returns true if the reCAPTCHA Enterprise enforcement state for the provider is set to ENFORCE or AUDIT.
2518
+ *
2519
+ * @param providerStr - The provider whose enablement state is to be returned.
2520
+ * @returns Whether or not reCAPTCHA Enterprise protection is enabled for the given provider.
2521
+ */
2522
+ isProviderEnabled(providerStr: string): boolean;
2523
+ }
2524
+
2525
+ declare interface RecaptchaEnforcementProviderState {
2526
+ provider: string;
2527
+ enforcementState: string;
2528
+ }
2529
+
2530
+ /**
2531
+ * Interface representing reCAPTCHA parameters.
2532
+ *
2533
+ * See the {@link https://developers.google.com/recaptcha/docs/display#render_param | reCAPTCHA docs}
2534
+ * for the list of accepted parameters. All parameters are accepted except for `sitekey`: Firebase Auth
2535
+ * provisions a reCAPTCHA for each project and will configure the site key upon rendering.
2536
+ *
2537
+ * For an invisible reCAPTCHA, set the `size` key to `invisible`.
2538
+ *
2539
+ * @public
2540
+ */
2541
+ export declare interface RecaptchaParameters {
2542
+ [key: string]: any;
2543
+ }
2544
+
2545
+ /**
2546
+ * Reloads user account data, if signed in.
2547
+ *
2548
+ * @param user - The user.
2549
+ *
2550
+ * @public
2551
+ */
2552
+ export declare function reload(user: User): Promise<void>;
2553
+
2554
+ /**
2555
+ * Revokes the given access token. Currently only supports Apple OAuth access tokens.
2556
+ *
2557
+ * @param auth - The {@link Auth} instance.
2558
+ * @param token - The Apple OAuth access token.
2559
+ *
2560
+ * @public
2561
+ */
2562
+ export declare function revokeAccessToken(auth: Auth, token: string): Promise<void>;
2563
+
2564
+ /**
2565
+ * An {@link AuthProvider} for SAML.
2566
+ *
2567
+ * @public
2568
+ */
2569
+ export declare class SAMLAuthProvider extends FederatedAuthProvider {
2570
+ /**
2571
+ * Constructor. The providerId must start with "saml."
2572
+ * @param providerId - SAML provider ID.
2573
+ */
2574
+ constructor(providerId: string);
2575
+ /**
2576
+ * Generates an {@link AuthCredential} from a {@link UserCredential} after a
2577
+ * successful SAML flow completes.
2578
+ *
2579
+ * @remarks
2580
+ *
2581
+ * For example, to get an {@link AuthCredential}, you could write the
2582
+ * following code:
2583
+ *
2584
+ * ```js
2585
+ * const userCredential = await signInWithPopup(auth, samlProvider);
2586
+ * const credential = SAMLAuthProvider.credentialFromResult(userCredential);
2587
+ * ```
2588
+ *
2589
+ * @param userCredential - The user credential.
2590
+ */
2591
+ static credentialFromResult(userCredential: UserCredential): AuthCredential | null;
2592
+ /**
2593
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
2594
+ * thrown during a sign-in, link, or reauthenticate operation.
2595
+ *
2596
+ * @param userCredential - The user credential.
2597
+ */
2598
+ static credentialFromError(error: FirebaseError): AuthCredential | null;
2599
+ /**
2600
+ * Creates an {@link AuthCredential} from a JSON string or a plain object.
2601
+ * @param json - A plain object or a JSON string
2602
+ */
2603
+ static credentialFromJSON(json: string | object): AuthCredential;
2604
+ private static samlCredentialFromTaggedObject;
2605
+ }
2606
+
2607
+ /**
2608
+ * Sends a verification email to a user.
2609
+ *
2610
+ * @remarks
2611
+ * The verification process is completed by calling {@link applyActionCode}.
2612
+ *
2613
+ * @example
2614
+ * ```javascript
2615
+ * const actionCodeSettings = {
2616
+ * url: 'https://www.example.com/?email=user@example.com',
2617
+ * iOS: {
2618
+ * bundleId: 'com.example.ios'
2619
+ * },
2620
+ * android: {
2621
+ * packageName: 'com.example.android',
2622
+ * installApp: true,
2623
+ * minimumVersion: '12'
2624
+ * },
2625
+ * handleCodeInApp: true
2626
+ * };
2627
+ * await sendEmailVerification(user, actionCodeSettings);
2628
+ * // Obtain code from the user.
2629
+ * await applyActionCode(auth, code);
2630
+ * ```
2631
+ *
2632
+ * @param user - The user.
2633
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
2634
+ *
2635
+ * @public
2636
+ */
2637
+ export declare function sendEmailVerification(user: User, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
2638
+
2639
+ /**
2640
+ * Sends a password reset email to the given email address. This method does not throw an error when
2641
+ * there's no user account with the given email address and
2642
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
2643
+ * is enabled.
2644
+ *
2645
+ * @remarks
2646
+ * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
2647
+ * the email sent to the user, along with the new password specified by the user.
2648
+ *
2649
+ * @example
2650
+ * ```javascript
2651
+ * const actionCodeSettings = {
2652
+ * url: 'https://www.example.com/?email=user@example.com',
2653
+ * iOS: {
2654
+ * bundleId: 'com.example.ios'
2655
+ * },
2656
+ * android: {
2657
+ * packageName: 'com.example.android',
2658
+ * installApp: true,
2659
+ * minimumVersion: '12'
2660
+ * },
2661
+ * handleCodeInApp: true
2662
+ * };
2663
+ * await sendPasswordResetEmail(auth, 'user@example.com', actionCodeSettings);
2664
+ * // Obtain code from user.
2665
+ * await confirmPasswordReset('user@example.com', code);
2666
+ * ```
2667
+ *
2668
+ * @param auth - The {@link Auth} instance.
2669
+ * @param email - The user's email address.
2670
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
2671
+ *
2672
+ * @public
2673
+ */
2674
+ export declare function sendPasswordResetEmail(auth: Auth, email: string, actionCodeSettings?: ActionCodeSettings): Promise<void>;
2675
+
2676
+ /**
2677
+ * Sends a sign-in email link to the user with the specified email.
2678
+ *
2679
+ * @remarks
2680
+ * The sign-in operation has to always be completed in the app unlike other out of band email
2681
+ * actions (password reset and email verifications). This is because, at the end of the flow,
2682
+ * the user is expected to be signed in and their Auth state persisted within the app.
2683
+ *
2684
+ * To complete sign in with the email link, call {@link signInWithEmailLink} with the email
2685
+ * address and the email link supplied in the email sent to the user.
2686
+ *
2687
+ * @example
2688
+ * ```javascript
2689
+ * const actionCodeSettings = {
2690
+ * url: 'https://www.example.com/?email=user@example.com',
2691
+ * iOS: {
2692
+ * bundleId: 'com.example.ios'
2693
+ * },
2694
+ * android: {
2695
+ * packageName: 'com.example.android',
2696
+ * installApp: true,
2697
+ * minimumVersion: '12'
2698
+ * },
2699
+ * handleCodeInApp: true
2700
+ * };
2701
+ * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
2702
+ * // Obtain emailLink from the user.
2703
+ * if(isSignInWithEmailLink(auth, emailLink)) {
2704
+ * await signInWithEmailLink(auth, 'user@example.com', emailLink);
2705
+ * }
2706
+ * ```
2707
+ *
2708
+ * @param authInternal - The {@link Auth} instance.
2709
+ * @param email - The user's email address.
2710
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
2711
+ *
2712
+ * @public
2713
+ */
2714
+ export declare function sendSignInLinkToEmail(auth: Auth, email: string, actionCodeSettings: ActionCodeSettings): Promise<void>;
2715
+
2716
+ /**
2717
+ * Changes the type of persistence on the {@link Auth} instance for the currently saved
2718
+ * `Auth` session and applies this type of persistence for future sign-in requests, including
2719
+ * sign-in with redirect requests.
2720
+ *
2721
+ * @remarks
2722
+ * This makes it easy for a user signing in to specify whether their session should be
2723
+ * remembered or not. It also makes it easier to never persist the `Auth` state for applications
2724
+ * that are shared by other users or have sensitive data.
2725
+ *
2726
+ * This method does not work in a Node.js environment or with {@link Auth} instances created with a
2727
+ * {@link @firebase/app#FirebaseServerApp}.
2728
+ *
2729
+ * @example
2730
+ * ```javascript
2731
+ * setPersistence(auth, browserSessionPersistence);
2732
+ * ```
2733
+ *
2734
+ * @param auth - The {@link Auth} instance.
2735
+ * @param persistence - The {@link Persistence} to use.
2736
+ * @returns A `Promise` that resolves once the persistence change has completed
2737
+ *
2738
+ * @public
2739
+ */
2740
+ export declare function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
2741
+
2742
+ /**
2743
+ * Asynchronously signs in as an anonymous user.
2744
+ *
2745
+ * @remarks
2746
+ * If there is already an anonymous user signed in, that user will be returned; otherwise, a
2747
+ * new anonymous user identity will be created and returned.
2748
+ *
2749
+ * This method is not supported by {@link Auth} instances created with a
2750
+ * {@link @firebase/app#FirebaseServerApp}.
2751
+ *
2752
+ * @param auth - The {@link Auth} instance.
2753
+ *
2754
+ * @public
2755
+ */
2756
+ export declare function signInAnonymously(auth: Auth): Promise<UserCredential>;
2757
+
2758
+ /**
2759
+ * Enumeration of supported sign-in methods.
2760
+ *
2761
+ * @public
2762
+ */
2763
+ export declare const SignInMethod: {
2764
+ /** Email link sign in method */
2765
+ readonly EMAIL_LINK: "emailLink";
2766
+ /** Email/password sign in method */
2767
+ readonly EMAIL_PASSWORD: "password";
2768
+ /** Facebook sign in method */
2769
+ readonly FACEBOOK: "facebook.com";
2770
+ /** GitHub sign in method */
2771
+ readonly GITHUB: "github.com";
2772
+ /** Google sign in method */
2773
+ readonly GOOGLE: "google.com";
2774
+ /** Phone sign in method */
2775
+ readonly PHONE: "phone";
2776
+ /** Twitter sign in method */
2777
+ readonly TWITTER: "twitter.com";
2778
+ };
2779
+
2780
+ /**
2781
+ * Asynchronously signs in with the given credentials.
2782
+ *
2783
+ * @remarks
2784
+ * An {@link AuthProvider} can be used to generate the credential.
2785
+ *
2786
+ * This method is not supported by {@link Auth} instances created with a
2787
+ * {@link @firebase/app#FirebaseServerApp}.
2788
+ *
2789
+ * @param auth - The {@link Auth} instance.
2790
+ * @param credential - The auth credential.
2791
+ *
2792
+ * @public
2793
+ */
2794
+ export declare function signInWithCredential(auth: Auth, credential: AuthCredential): Promise<UserCredential>;
2795
+
2796
+ /**
2797
+ * Asynchronously signs in using a custom token.
2798
+ *
2799
+ * @remarks
2800
+ * Custom tokens are used to integrate Firebase Auth with existing auth systems, and must
2801
+ * be generated by an auth backend using the
2802
+ * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#createcustomtoken | createCustomToken}
2803
+ * method in the {@link https://firebase.google.com/docs/auth/admin | Admin SDK} .
2804
+ *
2805
+ * Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
2806
+ *
2807
+ * This method is not supported by {@link Auth} instances created with a
2808
+ * {@link @firebase/app#FirebaseServerApp}.
2809
+ *
2810
+ * @param auth - The {@link Auth} instance.
2811
+ * @param customToken - The custom token to sign in with.
2812
+ *
2813
+ * @public
2814
+ */
2815
+ export declare function signInWithCustomToken(auth: Auth, customToken: string): Promise<UserCredential>;
2816
+
2817
+ /**
2818
+ * Asynchronously signs in using an email and password.
2819
+ *
2820
+ * @remarks
2821
+ * Fails with an error if the email address and password do not match. When
2822
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
2823
+ * is enabled, this method fails with "auth/invalid-credential" in case of an invalid
2824
+ * email/password.
2825
+ *
2826
+ * This method is not supported on {@link Auth} instances created with a
2827
+ * {@link @firebase/app#FirebaseServerApp}.
2828
+ *
2829
+ * Note: The user's password is NOT the password used to access the user's email account. The
2830
+ * email address serves as a unique identifier for the user, and the password is used to access
2831
+ * the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
2832
+ *
2833
+ *
2834
+ * @param auth - The {@link Auth} instance.
2835
+ * @param email - The users email address.
2836
+ * @param password - The users password.
2837
+ *
2838
+ * @public
2839
+ */
2840
+ export declare function signInWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;
2841
+
2842
+ /**
2843
+ * Asynchronously signs in using an email and sign-in email link.
2844
+ *
2845
+ * @remarks
2846
+ * If no link is passed, the link is inferred from the current URL.
2847
+ *
2848
+ * Fails with an error if the email address is invalid or OTP in email link expires.
2849
+ *
2850
+ * This method is not supported by {@link Auth} instances created with a
2851
+ * {@link @firebase/app#FirebaseServerApp}.
2852
+ *
2853
+ * Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
2854
+ *
2855
+ * @example
2856
+ * ```javascript
2857
+ * const actionCodeSettings = {
2858
+ * url: 'https://www.example.com/?email=user@example.com',
2859
+ * iOS: {
2860
+ * bundleId: 'com.example.ios'
2861
+ * },
2862
+ * android: {
2863
+ * packageName: 'com.example.android',
2864
+ * installApp: true,
2865
+ * minimumVersion: '12'
2866
+ * },
2867
+ * handleCodeInApp: true
2868
+ * };
2869
+ * await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings);
2870
+ * // Obtain emailLink from the user.
2871
+ * if(isSignInWithEmailLink(auth, emailLink)) {
2872
+ * await signInWithEmailLink(auth, 'user@example.com', emailLink);
2873
+ * }
2874
+ * ```
2875
+ *
2876
+ *
2877
+ * @param auth - The {@link Auth} instance.
2878
+ * @param email - The user's email address.
2879
+ * @param emailLink - The link sent to the user's email address.
2880
+ *
2881
+ * @public
2882
+ */
2883
+ export declare function signInWithEmailLink(auth: Auth, email: string, emailLink?: string): Promise<UserCredential>;
2884
+
2885
+ /* Excluded from this release type: SignInWithIdpResponse */
2886
+
2887
+ /* Excluded from this release type: SignInWithPhoneNumberRequest */
2888
+
2889
+ /* Excluded from this release type: SignInWithPhoneNumberResponse */
2890
+
2891
+ export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void>;
2892
+
2893
+ /**
2894
+ * Signs out the current user.
2895
+ *
2896
+ * @remarks
2897
+ * This method is not supported by {@link Auth} instances created with a
2898
+ * {@link @firebase/app#FirebaseServerApp}.
2899
+ *
2900
+ * @param auth - The {@link Auth} instance.
2901
+ *
2902
+ * @public
2903
+ */
2904
+ export declare function signOut(auth: Auth): Promise<void>;
2905
+
2906
+ /* Excluded from this release type: StsTokenManager */
2907
+
2908
+ /* Excluded from this release type: TaggedWithTokenResponse */
2909
+
2910
+ /**
2911
+ * An MFA provided by TOTP (Time-based One Time Password).
2912
+ */
2913
+ declare interface TotpMfaEnrollment extends BaseMfaEnrollment {
2914
+ }
2915
+
2916
+ /**
2917
+ * The class for asserting ownership of a TOTP second factor. Provided by
2918
+ * {@link TotpMultiFactorGenerator.assertionForEnrollment} and
2919
+ * {@link TotpMultiFactorGenerator.assertionForSignIn}.
2920
+ *
2921
+ * @public
2922
+ */
2923
+ export declare interface TotpMultiFactorAssertion extends MultiFactorAssertion {
2924
+ }
2925
+
2926
+ /**
2927
+ * The subclass of the {@link MultiFactorInfo} interface for TOTP
2928
+ * second factors. The `factorId` of this second factor is {@link FactorId}.TOTP.
2929
+ * @public
2930
+ */
2931
+ export declare interface TotpMultiFactorInfo extends MultiFactorInfo {
2932
+ }
2933
+
2934
+ /**
2935
+ * Provider for generating an {@link OAuthCredential} for {@link ProviderId}.TWITTER.
2936
+ *
2937
+ * @example
2938
+ * ```javascript
2939
+ * // Sign in using a redirect.
2940
+ * const provider = new TwitterAuthProvider();
2941
+ * // Start a sign in process for an unauthenticated user.
2942
+ * await signInWithRedirect(auth, provider);
2943
+ * // This will trigger a full page redirect away from your app
2944
+ *
2945
+ * // After returning from the redirect when your app initializes you can obtain the result
2946
+ * const result = await getRedirectResult(auth);
2947
+ * if (result) {
2948
+ * // This is the signed-in user
2949
+ * const user = result.user;
2950
+ * // This gives you a Twitter Access Token and Secret.
2951
+ * const credential = TwitterAuthProvider.credentialFromResult(result);
2952
+ * const token = credential.accessToken;
2953
+ * const secret = credential.secret;
2954
+ * }
2955
+ * ```
2956
+ *
2957
+ * @example
2958
+ * ```javascript
2959
+ * // Sign in using a popup.
2960
+ * const provider = new TwitterAuthProvider();
2961
+ * const result = await signInWithPopup(auth, provider);
2962
+ *
2963
+ * // The signed-in user info.
2964
+ * const user = result.user;
2965
+ * // This gives you a Twitter Access Token and Secret.
2966
+ * const credential = TwitterAuthProvider.credentialFromResult(result);
2967
+ * const token = credential.accessToken;
2968
+ * const secret = credential.secret;
2969
+ * ```
2970
+ *
2971
+ * @public
2972
+ */
2973
+ export declare class TwitterAuthProvider extends BaseOAuthProvider {
2974
+ /** Always set to {@link SignInMethod}.TWITTER. */
2975
+ static readonly TWITTER_SIGN_IN_METHOD: 'twitter.com';
2976
+ /** Always set to {@link ProviderId}.TWITTER. */
2977
+ static readonly PROVIDER_ID: 'twitter.com';
2978
+ constructor();
2979
+ /**
2980
+ * Creates a credential for Twitter.
2981
+ *
2982
+ * @param token - Twitter access token.
2983
+ * @param secret - Twitter secret.
2984
+ */
2985
+ static credential(token: string, secret: string): OAuthCredential;
2986
+ /**
2987
+ * Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
2988
+ *
2989
+ * @param userCredential - The user credential.
2990
+ */
2991
+ static credentialFromResult(userCredential: UserCredential): OAuthCredential | null;
2992
+ /**
2993
+ * Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
2994
+ * thrown during a sign-in, link, or reauthenticate operation.
2995
+ *
2996
+ * @param userCredential - The user credential.
2997
+ */
2998
+ static credentialFromError(error: FirebaseError): OAuthCredential | null;
2999
+ private static credentialFromTaggedObject;
3000
+ }
3001
+
3002
+ /**
3003
+ * Unlinks a provider from a user account.
3004
+ *
3005
+ * @param user - The user.
3006
+ * @param providerId - The provider to unlink.
3007
+ *
3008
+ * @public
3009
+ */
3010
+ export declare function unlink(user: User, providerId: string): Promise<User>;
3011
+ export { Unsubscribe }
3012
+
3013
+ /**
3014
+ * Asynchronously sets the provided user as {@link Auth.currentUser} on the
3015
+ * {@link Auth} instance.
3016
+ *
3017
+ * @remarks
3018
+ * A new instance copy of the user provided will be made and set as currentUser.
3019
+ *
3020
+ * This will trigger {@link onAuthStateChanged} and {@link onIdTokenChanged} listeners
3021
+ * like other sign in methods.
3022
+ *
3023
+ * The operation fails with an error if the user to be updated belongs to a different Firebase
3024
+ * project.
3025
+ *
3026
+ * This method is not supported by {@link Auth} instances created with a
3027
+ * {@link @firebase/app#FirebaseServerApp}.
3028
+ *
3029
+ * @param auth - The {@link Auth} instance.
3030
+ * @param user - The new {@link User}.
3031
+ *
3032
+ * @public
3033
+ */
3034
+ export declare function updateCurrentUser(auth: Auth, user: User | null): Promise<void>;
3035
+
3036
+ /**
3037
+ * Updates the user's email address.
3038
+ *
3039
+ * @remarks
3040
+ * An email will be sent to the original email address (if it was set) that allows to revoke the
3041
+ * email address change, in order to protect them from account hijacking.
3042
+ *
3043
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
3044
+ * created with a {@link @firebase/app#FirebaseServerApp}.
3045
+ *
3046
+ * Important: this is a security sensitive operation that requires the user to have recently signed
3047
+ * in. If this requirement isn't met, ask the user to authenticate again and then call
3048
+ * {@link reauthenticateWithCredential}.
3049
+ *
3050
+ * @param user - The user.
3051
+ * @param newEmail - The new email address.
3052
+ *
3053
+ * Throws "auth/operation-not-allowed" error when
3054
+ * {@link https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection | Email Enumeration Protection}
3055
+ * is enabled.
3056
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
3057
+ *
3058
+ * @public
3059
+ */
3060
+ export declare function updateEmail(user: User, newEmail: string): Promise<void>;
3061
+
3062
+ /**
3063
+ * Updates the user's password.
3064
+ *
3065
+ * @remarks
3066
+ * Important: this is a security sensitive operation that requires the user to have recently signed
3067
+ * in. If this requirement isn't met, ask the user to authenticate again and then call
3068
+ * {@link reauthenticateWithCredential}.
3069
+ *
3070
+ * @param user - The user.
3071
+ * @param newPassword - The new password.
3072
+ *
3073
+ * @public
3074
+ */
3075
+ export declare function updatePassword(user: User, newPassword: string): Promise<void>;
3076
+
3077
+ /**
3078
+ * Updates a user's profile data.
3079
+ *
3080
+ * @param user - The user.
3081
+ * @param profile - The profile's `displayName` and `photoURL` to update.
3082
+ *
3083
+ * @public
3084
+ */
3085
+ export declare function updateProfile(user: User, { displayName, photoURL: photoUrl }: {
3086
+ displayName?: string | null;
3087
+ photoURL?: string | null;
3088
+ }): Promise<void>;
3089
+
3090
+ /**
3091
+ * Sets the current language to the default device/browser preference.
3092
+ *
3093
+ * @param auth - The {@link Auth} instance.
3094
+ *
3095
+ * @public
3096
+ */
3097
+ export declare function useDeviceLanguage(auth: Auth): void;
3098
+
3099
+ /**
3100
+ * A user account.
3101
+ *
3102
+ * @public
3103
+ */
3104
+ export declare interface User extends UserInfo {
3105
+ /**
3106
+ * Whether the email has been verified with {@link sendEmailVerification} and
3107
+ * {@link applyActionCode}.
3108
+ */
3109
+ readonly emailVerified: boolean;
3110
+ /**
3111
+ * Whether the user is authenticated using the {@link ProviderId}.ANONYMOUS provider.
3112
+ */
3113
+ readonly isAnonymous: boolean;
3114
+ /**
3115
+ * Additional metadata around user creation and sign-in times.
3116
+ */
3117
+ readonly metadata: UserMetadata;
3118
+ /**
3119
+ * Additional per provider such as displayName and profile information.
3120
+ */
3121
+ readonly providerData: UserInfo[];
3122
+ /**
3123
+ * Refresh token used to reauthenticate the user. Avoid using this directly and prefer
3124
+ * {@link User.getIdToken} to refresh the ID token instead.
3125
+ */
3126
+ readonly refreshToken: string;
3127
+ /**
3128
+ * The user's tenant ID.
3129
+ *
3130
+ * @remarks
3131
+ * This is a read-only property, which indicates the tenant ID
3132
+ * used to sign in the user. This is null if the user is signed in from the parent
3133
+ * project.
3134
+ *
3135
+ * @example
3136
+ * ```javascript
3137
+ * // Set the tenant ID on Auth instance.
3138
+ * auth.tenantId = 'TENANT_PROJECT_ID';
3139
+ *
3140
+ * // All future sign-in request now include tenant ID.
3141
+ * const result = await signInWithEmailAndPassword(auth, email, password);
3142
+ * // result.user.tenantId should be 'TENANT_PROJECT_ID'.
3143
+ * ```
3144
+ */
3145
+ readonly tenantId: string | null;
3146
+ /**
3147
+ * Deletes and signs out the user.
3148
+ *
3149
+ * @remarks
3150
+ * Important: this is a security-sensitive operation that requires the user to have recently
3151
+ * signed in. If this requirement isn't met, ask the user to authenticate again and then call
3152
+ * one of the reauthentication methods like {@link reauthenticateWithCredential}.
3153
+ *
3154
+ * This method is not supported on any {@link User} signed in by {@link Auth} instances
3155
+ * created with a {@link @firebase/app#FirebaseServerApp}.
3156
+ */
3157
+ delete(): Promise<void>;
3158
+ /**
3159
+ * Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
3160
+ *
3161
+ * @remarks
3162
+ * Returns the current token if it has not expired or if it will not expire in the next five
3163
+ * minutes. Otherwise, this will refresh the token and return a new one.
3164
+ *
3165
+ * @param forceRefresh - Force refresh regardless of token expiration.
3166
+ */
3167
+ getIdToken(forceRefresh?: boolean): Promise<string>;
3168
+ /**
3169
+ * Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
3170
+ *
3171
+ * @remarks
3172
+ * Returns the current token if it has not expired or if it will not expire in the next five
3173
+ * minutes. Otherwise, this will refresh the token and return a new one.
3174
+ *
3175
+ * @param forceRefresh - Force refresh regardless of token expiration.
3176
+ */
3177
+ getIdTokenResult(forceRefresh?: boolean): Promise<IdTokenResult>;
3178
+ /**
3179
+ * Refreshes the user, if signed in.
3180
+ */
3181
+ reload(): Promise<void>;
3182
+ /**
3183
+ * Returns a JSON-serializable representation of this object.
3184
+ *
3185
+ * @returns A JSON-serializable representation of this object.
3186
+ */
3187
+ toJSON(): object;
3188
+ }
3189
+
3190
+ /**
3191
+ * A structure containing a {@link User}, the {@link OperationType}, and the provider ID.
3192
+ *
3193
+ * @remarks
3194
+ * `operationType` could be {@link OperationType}.SIGN_IN for a sign-in operation,
3195
+ * {@link OperationType}.LINK for a linking operation and {@link OperationType}.REAUTHENTICATE for
3196
+ * a reauthentication operation.
3197
+ *
3198
+ * @public
3199
+ */
3200
+ export declare interface UserCredential {
3201
+ /**
3202
+ * The user authenticated by this credential.
3203
+ */
3204
+ user: User;
3205
+ /**
3206
+ * The provider which was used to authenticate the user.
3207
+ */
3208
+ providerId: string | null;
3209
+ /**
3210
+ * The type of operation which was used to authenticate the user (such as sign-in or link).
3211
+ */
3212
+ operationType: (typeof OperationType)[keyof typeof OperationType];
3213
+ }
3214
+
3215
+ /* Excluded from this release type: UserCredentialInternal */
3216
+
3217
+ /**
3218
+ * User profile information, visible only to the Firebase project's apps.
3219
+ *
3220
+ * @public
3221
+ */
3222
+ export declare interface UserInfo {
3223
+ /**
3224
+ * The display name of the user.
3225
+ */
3226
+ readonly displayName: string | null;
3227
+ /**
3228
+ * The email of the user.
3229
+ */
3230
+ readonly email: string | null;
3231
+ /**
3232
+ * The phone number normalized based on the E.164 standard (e.g. +16505550101) for the
3233
+ * user.
3234
+ *
3235
+ * @remarks
3236
+ * This is null if the user has no phone credential linked to the account.
3237
+ */
3238
+ readonly phoneNumber: string | null;
3239
+ /**
3240
+ * The profile photo URL of the user.
3241
+ */
3242
+ readonly photoURL: string | null;
3243
+ /**
3244
+ * The provider used to authenticate the user.
3245
+ */
3246
+ readonly providerId: string;
3247
+ /**
3248
+ * The user's unique ID, scoped to the project.
3249
+ */
3250
+ readonly uid: string;
3251
+ }
3252
+
3253
+ /* Excluded from this release type: UserInternal */
3254
+
3255
+ /**
3256
+ * Interface representing a user's metadata.
3257
+ *
3258
+ * @public
3259
+ */
3260
+ export declare interface UserMetadata {
3261
+ /** Time the user was created. */
3262
+ readonly creationTime?: string;
3263
+ /** Time the user last signed in. */
3264
+ readonly lastSignInTime?: string;
3265
+ }
3266
+
3267
+ declare class UserMetadata_2 implements UserMetadata {
3268
+ private createdAt?;
3269
+ private lastLoginAt?;
3270
+ creationTime?: string;
3271
+ lastSignInTime?: string;
3272
+ constructor(createdAt?: string | number | undefined, lastLoginAt?: string | number | undefined);
3273
+ private _initializeTime;
3274
+ _copy(metadata: UserMetadata_2): void;
3275
+ toJSON(): object;
3276
+ }
3277
+
3278
+ /**
3279
+ * User profile used in {@link AdditionalUserInfo}.
3280
+ *
3281
+ * @public
3282
+ */
3283
+ export declare type UserProfile = Record<string, unknown>;
3284
+
3285
+ /**
3286
+ * Validates the password against the password policy configured for the project or tenant.
3287
+ *
3288
+ * @remarks
3289
+ * If no tenant ID is set on the `Auth` instance, then this method will use the password
3290
+ * policy configured for the project. Otherwise, this method will use the policy configured
3291
+ * for the tenant. If a password policy has not been configured, then the default policy
3292
+ * configured for all projects will be used.
3293
+ *
3294
+ * If an auth flow fails because a submitted password does not meet the password policy
3295
+ * requirements and this method has previously been called, then this method will use the
3296
+ * most recent policy available when called again.
3297
+ *
3298
+ * @example
3299
+ * ```javascript
3300
+ * validatePassword(auth, 'some-password');
3301
+ * ```
3302
+ *
3303
+ * @param auth The {@link Auth} instance.
3304
+ * @param password The password to validate.
3305
+ *
3306
+ * @public
3307
+ */
3308
+ export declare function validatePassword(auth: Auth, password: string): Promise<PasswordValidationStatus>;
3309
+
3310
+ /**
3311
+ * Sends a verification email to a new email address.
3312
+ *
3313
+ * @remarks
3314
+ * The user's email will be updated to the new one after being verified.
3315
+ *
3316
+ * If you have a custom email action handler, you can complete the verification process by calling
3317
+ * {@link applyActionCode}.
3318
+ *
3319
+ * @example
3320
+ * ```javascript
3321
+ * const actionCodeSettings = {
3322
+ * url: 'https://www.example.com/?email=user@example.com',
3323
+ * iOS: {
3324
+ * bundleId: 'com.example.ios'
3325
+ * },
3326
+ * android: {
3327
+ * packageName: 'com.example.android',
3328
+ * installApp: true,
3329
+ * minimumVersion: '12'
3330
+ * },
3331
+ * handleCodeInApp: true
3332
+ * };
3333
+ * await verifyBeforeUpdateEmail(user, 'newemail@example.com', actionCodeSettings);
3334
+ * // Obtain code from the user.
3335
+ * await applyActionCode(auth, code);
3336
+ * ```
3337
+ *
3338
+ * @param user - The user.
3339
+ * @param newEmail - The new email address to be verified before update.
3340
+ * @param actionCodeSettings - The {@link ActionCodeSettings}.
3341
+ *
3342
+ * @public
3343
+ */
3344
+ export declare function verifyBeforeUpdateEmail(user: User, newEmail: string, actionCodeSettings?: ActionCodeSettings | null): Promise<void>;
3345
+
3346
+ /**
3347
+ * Checks a password reset code sent to the user by email or other out-of-band mechanism.
3348
+ *
3349
+ * @returns the user's email address if valid.
3350
+ *
3351
+ * @param auth - The {@link Auth} instance.
3352
+ * @param code - A verification code sent to the user.
3353
+ *
3354
+ * @public
3355
+ */
3356
+ export declare function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>;
3357
+
3358
+ export { }