@react-native-firebase/auth 20.3.0 → 20.5.0
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.
- package/CHANGELOG.md +8 -0
- package/__tests__/auth.test.ts +275 -1
- package/lib/index.d.ts +17 -1
- package/lib/index.js +28 -57
- package/lib/modular/index.d.ts +662 -0
- package/lib/modular/index.js +296 -176
- package/lib/version.js +1 -1
- package/package.json +3 -3
@@ -0,0 +1,662 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
+
/*
|
3
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this library except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
import { FirebaseApp } from '@firebase/app-types';
|
19
|
+
import { FirebaseAuthTypes, CallbackOrObserver, AuthListenerCallback } from '../index';
|
20
|
+
import { firebase } from '..';
|
21
|
+
|
22
|
+
import Auth = FirebaseAuthTypes.Module;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Returns the Auth instance associated with the provided FirebaseApp.
|
26
|
+
* @param app - The Firebase app instance.
|
27
|
+
* @returns The Auth instance.
|
28
|
+
*/
|
29
|
+
export function getAuth(app?: FirebaseApp): Auth;
|
30
|
+
|
31
|
+
/**
|
32
|
+
* This function allows more control over the Auth instance than getAuth().
|
33
|
+
*
|
34
|
+
* @param app - The Firebase app instance.
|
35
|
+
* @param deps - Optional. Dependencies for the Auth instance.
|
36
|
+
* @returns The Auth instance.
|
37
|
+
*
|
38
|
+
* getAuth uses platform-specific defaults to supply the Dependencies.
|
39
|
+
* In general, getAuth is the easiest way to initialize Auth and works for most use cases.
|
40
|
+
* Use initializeAuth if you need control over which persistence layer is used, or to minimize bundle size
|
41
|
+
* if you're not using either signInWithPopup or signInWithRedirect.
|
42
|
+
*/
|
43
|
+
export function initializeAuth(app: FirebaseApp, deps?: any): Auth;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Applies a verification code sent to the user by email or other out-of-band mechanism.
|
47
|
+
*
|
48
|
+
* @param auth - The Auth instance.
|
49
|
+
* @param oobCode - The out-of-band code sent to the user.
|
50
|
+
* @returns A promise that resolves when the code is applied successfully.
|
51
|
+
*/
|
52
|
+
export function applyActionCode(auth: Auth, oobCode: string): Promise<void>;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Adds a blocking callback that runs before an auth state change sets a new user.
|
56
|
+
*
|
57
|
+
* @param auth - The Auth instance.
|
58
|
+
* @param callback - A callback function to run before the auth state changes.
|
59
|
+
* @param onAbort - Optional. A callback function to run if the operation is aborted.
|
60
|
+
*/
|
61
|
+
export function beforeAuthStateChanged(
|
62
|
+
auth: Auth,
|
63
|
+
callback: (user: FirebaseAuthTypes.User | null) => void,
|
64
|
+
onAbort?: () => void,
|
65
|
+
): void;
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Checks a verification code sent to the user by email or other out-of-band mechanism.
|
69
|
+
*
|
70
|
+
* @param auth - The Auth instance.
|
71
|
+
* @param oobCode - The out-of-band code sent to the user.
|
72
|
+
* @returns A promise that resolves with the action code information.
|
73
|
+
*/
|
74
|
+
export function checkActionCode(
|
75
|
+
auth: Auth,
|
76
|
+
oobCode: string,
|
77
|
+
): Promise<FirebaseAuthTypes.ActionCodeInfo>;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Completes the password reset process, given a confirmation code and new password.
|
81
|
+
*
|
82
|
+
* @param auth - The Auth instance.
|
83
|
+
* @param oobCode - The out-of-band code sent to the user.
|
84
|
+
* @param newPassword - The new password.
|
85
|
+
* @returns A promise that resolves when the password is reset.
|
86
|
+
*/
|
87
|
+
export function confirmPasswordReset(
|
88
|
+
auth: Auth,
|
89
|
+
oobCode: string,
|
90
|
+
newPassword: string,
|
91
|
+
): Promise<void>;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Changes the Auth instance to communicate with the Firebase Auth Emulator, instead of production Firebase Auth services.
|
95
|
+
*
|
96
|
+
* @param auth - The Auth instance.
|
97
|
+
* @param url - The URL of the Firebase Auth Emulator.
|
98
|
+
* @param options - Optional. Options for the emulator connection.
|
99
|
+
*
|
100
|
+
* This must be called synchronously immediately following the first call to initializeAuth(). Do not use with production credentials as emulator traffic is not encrypted.
|
101
|
+
*/
|
102
|
+
export function connectAuthEmulator(
|
103
|
+
auth: Auth,
|
104
|
+
url: string,
|
105
|
+
options?: { disableWarnings: boolean },
|
106
|
+
): void;
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Creates a new user account associated with the specified email address and password.
|
110
|
+
*
|
111
|
+
* @param auth - The Auth instance.
|
112
|
+
* @param email - The user's email address.
|
113
|
+
* @param password - The user's password.
|
114
|
+
* @returns A promise that resolves with the user credentials.
|
115
|
+
*/
|
116
|
+
export function createUserWithEmailAndPassword(
|
117
|
+
auth: Auth,
|
118
|
+
email: string,
|
119
|
+
password: string,
|
120
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Gets the list of possible sign in methods for the given email address.
|
124
|
+
*
|
125
|
+
* @param auth - The Auth instance.
|
126
|
+
* @param email - The user's email address.
|
127
|
+
* @returns A promise that resolves with the list of sign-in methods.
|
128
|
+
*/
|
129
|
+
export function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Provides a MultiFactorResolver suitable for completion of a multi-factor flow.
|
133
|
+
*
|
134
|
+
* @param auth - The Auth instance.
|
135
|
+
* @param error - The multi-factor error.
|
136
|
+
* @returns The MultiFactorResolver instance.
|
137
|
+
*/
|
138
|
+
export function getMultiFactorResolver(
|
139
|
+
auth: Auth,
|
140
|
+
error: FirebaseAuthTypes.MultiFactorError,
|
141
|
+
): FirebaseAuthTypes.MultiFactorResolver;
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Returns a UserCredential from the redirect-based sign-in flow.
|
145
|
+
*
|
146
|
+
* @param auth - The Auth instance.
|
147
|
+
* @param resolver - Optional. The popup redirect resolver.
|
148
|
+
* @returns A promise that resolves with the user credentials or null.
|
149
|
+
*/
|
150
|
+
export interface PopupRedirectResolver {}
|
151
|
+
|
152
|
+
export function getRedirectResult(
|
153
|
+
auth: Auth,
|
154
|
+
resolver?: PopupRedirectResolver,
|
155
|
+
): Promise<FirebaseAuthTypes.UserCredential | null>;
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Checks if an incoming link is a sign-in with email link suitable for signInWithEmailLink().
|
159
|
+
*
|
160
|
+
* @param auth - The Auth instance.
|
161
|
+
* @param emailLink - The email link to check.
|
162
|
+
* @returns True if the link is a sign-in with email link.
|
163
|
+
*/
|
164
|
+
export function isSignInWithEmailLink(auth: Auth, emailLink: string): boolean;
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Adds an observer for changes to the user's sign-in state.
|
168
|
+
*
|
169
|
+
* @param auth - The Auth instance.
|
170
|
+
* @param nextOrObserver - A callback function or observer for auth state changes.
|
171
|
+
* @returns A function to unsubscribe from the auth state changes.
|
172
|
+
*/
|
173
|
+
export function onAuthStateChanged(
|
174
|
+
auth: Auth,
|
175
|
+
nextOrObserver: CallbackOrObserver<AuthListenerCallback>,
|
176
|
+
): () => void;
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Adds an observer for changes to the signed-in user's ID token.
|
180
|
+
*
|
181
|
+
* @param auth - The Auth instance.
|
182
|
+
* @param nextOrObserver - A callback function or observer for ID token changes.
|
183
|
+
* @returns A function to unsubscribe from the ID token changes.
|
184
|
+
*/
|
185
|
+
export function onIdTokenChanged(
|
186
|
+
auth: Auth,
|
187
|
+
nextOrObserver: CallbackOrObserver<AuthListenerCallback>,
|
188
|
+
): () => void;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Sends a password reset email to the given email address.
|
192
|
+
*
|
193
|
+
* @param auth - The Auth instance.
|
194
|
+
* @param email - The user's email address.
|
195
|
+
* @param actionCodeSettings - Optional. Action code settings.
|
196
|
+
* @returns A promise that resolves when the email is sent.
|
197
|
+
*/
|
198
|
+
export function sendPasswordResetEmail(
|
199
|
+
auth: Auth,
|
200
|
+
email: string,
|
201
|
+
actionCodeSettings?: FirebaseAuthTypes.ActionCodeSettings,
|
202
|
+
): Promise<void>;
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Sends a sign-in email link to the user with the specified email.
|
206
|
+
*
|
207
|
+
* @param auth - The Auth instance.
|
208
|
+
* @param email - The user's email address.
|
209
|
+
* @param actionCodeSettings - Optional. Action code settings.
|
210
|
+
* @returns A promise that resolves when the email is sent.
|
211
|
+
*/
|
212
|
+
export function sendSignInLinkToEmail(
|
213
|
+
auth: Auth,
|
214
|
+
email: string,
|
215
|
+
actionCodeSettings?: FirebaseAuthTypes.ActionCodeSettings,
|
216
|
+
): Promise<void>;
|
217
|
+
|
218
|
+
/**
|
219
|
+
* Type of Persistence.
|
220
|
+
* - 'SESSION' is used for temporary persistence such as `sessionStorage`.
|
221
|
+
* - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`.
|
222
|
+
* - 'NONE' is used for in-memory, or no persistence.
|
223
|
+
*/
|
224
|
+
export type Persistence = {
|
225
|
+
readonly type: 'SESSION' | 'LOCAL' | 'NONE';
|
226
|
+
};
|
227
|
+
|
228
|
+
/**
|
229
|
+
* Changes the type of persistence on the Auth instance for the currently saved Auth session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests.
|
230
|
+
*
|
231
|
+
* @param auth - The Auth instance.
|
232
|
+
* @param persistence - The persistence type.
|
233
|
+
* @returns A promise that resolves when the persistence is set.
|
234
|
+
*/
|
235
|
+
export function setPersistence(auth: Auth, persistence: Persistence): Promise<void>;
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Asynchronously signs in as an anonymous user.
|
239
|
+
*
|
240
|
+
* @param auth - The Auth instance.
|
241
|
+
* @returns A promise that resolves with the user credentials.
|
242
|
+
*/
|
243
|
+
export function signInAnonymously(auth: Auth): Promise<FirebaseAuthTypes.UserCredential>;
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Asynchronously signs in with the given credentials.
|
247
|
+
*
|
248
|
+
* @param auth - The Auth instance.
|
249
|
+
* @param credential - The auth credentials.
|
250
|
+
* @returns A promise that resolves with the user credentials.
|
251
|
+
*/
|
252
|
+
export function signInWithCredential(
|
253
|
+
auth: Auth,
|
254
|
+
credential: FirebaseAuthTypes.AuthCredential,
|
255
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Asynchronously signs in using a custom token.
|
259
|
+
*
|
260
|
+
* @param auth - The Auth instance.
|
261
|
+
* @param customToken - The custom token.
|
262
|
+
* @returns A promise that resolves with the user credentials.
|
263
|
+
*/
|
264
|
+
export function signInWithCustomToken(
|
265
|
+
auth: Auth,
|
266
|
+
customToken: string,
|
267
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Asynchronously signs in using an email and password.
|
271
|
+
*
|
272
|
+
* @param auth - The Auth instance.
|
273
|
+
* @param email - The user's email address.
|
274
|
+
* @param password - The user's password.
|
275
|
+
* @returns A promise that resolves with the user credentials.
|
276
|
+
*/
|
277
|
+
export function signInWithEmailAndPassword(
|
278
|
+
auth: Auth,
|
279
|
+
email: string,
|
280
|
+
password: string,
|
281
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Asynchronously signs in using an email and sign-in email link.
|
285
|
+
*
|
286
|
+
* @param auth - The Auth instance.
|
287
|
+
* @param email - The user's email address.
|
288
|
+
* @param emailLink - The email link.
|
289
|
+
* @returns A promise that resolves with the user credentials.
|
290
|
+
*/
|
291
|
+
export function signInWithEmailLink(
|
292
|
+
auth: Auth,
|
293
|
+
email: string,
|
294
|
+
emailLink: string,
|
295
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Interface representing an application verifier.
|
299
|
+
*/
|
300
|
+
export interface ApplicationVerifier {
|
301
|
+
type: string;
|
302
|
+
verify(): Promise<string>;
|
303
|
+
}
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Asynchronously signs in using a phone number.
|
307
|
+
*
|
308
|
+
* @param auth - The Auth instance.
|
309
|
+
* @param phoneNumber - The user's phone number.
|
310
|
+
* @param appVerifier - The application verifier.
|
311
|
+
* @returns A promise that resolves with the confirmation result.
|
312
|
+
*/
|
313
|
+
export function signInWithPhoneNumber(
|
314
|
+
auth: Auth,
|
315
|
+
phoneNumber: string,
|
316
|
+
appVerifier: ApplicationVerifier,
|
317
|
+
): Promise<FirebaseAuthTypes.ConfirmationResult>;
|
318
|
+
|
319
|
+
/**
|
320
|
+
* Asynchronously signs in using a phone number.
|
321
|
+
*
|
322
|
+
* @param auth - The Auth instance.
|
323
|
+
* @param phoneNumber - The user's phone number.
|
324
|
+
* @param autoVerifyTimeoutOrForceResend - The auto verify timeout or force resend flag.
|
325
|
+
* @param forceResend - Optional. Whether to force resend.
|
326
|
+
* @returns A promise that resolves with the phone auth listener.
|
327
|
+
*/
|
328
|
+
export function verifyPhoneNumber(
|
329
|
+
auth: Auth,
|
330
|
+
phoneNumber: string,
|
331
|
+
autoVerifyTimeoutOrForceResend: number | boolean,
|
332
|
+
forceResend?: boolean,
|
333
|
+
): FirebaseAuthTypes.PhoneAuthListener;
|
334
|
+
|
335
|
+
/**
|
336
|
+
* Authenticates a Firebase client using a popup-based OAuth authentication flow.
|
337
|
+
*
|
338
|
+
* @param auth - The Auth instance.
|
339
|
+
* @param provider - The auth provider.
|
340
|
+
* @param resolver - Optional. The popup redirect resolver.
|
341
|
+
* @returns A promise that resolves with the user credentials.
|
342
|
+
*/
|
343
|
+
export function signInWithPopup(
|
344
|
+
auth: Auth,
|
345
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
346
|
+
resolver?: PopupRedirectResolver,
|
347
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Authenticates a Firebase client using a full-page redirect flow.
|
351
|
+
*
|
352
|
+
* @param auth - The Auth instance.
|
353
|
+
* @param provider - The auth provider.
|
354
|
+
* @param resolver - Optional. The popup redirect resolver.
|
355
|
+
* @returns A promise that resolves when the redirect is complete.
|
356
|
+
*/
|
357
|
+
export function signInWithRedirect(
|
358
|
+
auth: Auth,
|
359
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
360
|
+
resolver?: PopupRedirectResolver,
|
361
|
+
): Promise<void>;
|
362
|
+
|
363
|
+
/**
|
364
|
+
* Signs out the current user.
|
365
|
+
*
|
366
|
+
* @param auth - The Auth instance.
|
367
|
+
* @returns A promise that resolves when the user is signed out.
|
368
|
+
*/
|
369
|
+
export function signOut(auth: Auth): Promise<void>;
|
370
|
+
|
371
|
+
/**
|
372
|
+
* Asynchronously sets the provided user as Auth.currentUser on the Auth instance.
|
373
|
+
*
|
374
|
+
* @param auth - The Auth instance.
|
375
|
+
* @param user - The user to set as the current user.
|
376
|
+
* @returns A promise that resolves when the user is set.
|
377
|
+
*/
|
378
|
+
export function updateCurrentUser(auth: Auth, user: FirebaseAuthTypes.User): Promise<void>;
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Sets the current language to the default device/browser preference.
|
382
|
+
*
|
383
|
+
* @param auth - The Auth instance.
|
384
|
+
*/
|
385
|
+
export function useDeviceLanguage(auth: Auth): void;
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Sets the current language to the default device/browser preference.
|
389
|
+
*
|
390
|
+
* @param auth - The Auth instance.
|
391
|
+
* @param userAccessGroup - The user access group.
|
392
|
+
* @returns A promise that resolves when the user access group is set.
|
393
|
+
*/
|
394
|
+
export function useUserAccessGroup(auth: Auth, userAccessGroup: string): Promise<void>;
|
395
|
+
|
396
|
+
/**
|
397
|
+
* Verifies the password reset code sent to the user by email or other out-of-band mechanism.
|
398
|
+
*
|
399
|
+
* @param auth - The Auth instance.
|
400
|
+
* @param code - The password reset code.
|
401
|
+
* @returns A promise that resolves with the user's email address.
|
402
|
+
*/
|
403
|
+
export function verifyPasswordResetCode(auth: Auth, code: string): Promise<string>;
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Parses the email action link string and returns an ActionCodeURL if the link is valid, otherwise returns null.
|
407
|
+
*
|
408
|
+
* @param link - The email action link string.
|
409
|
+
* @returns The ActionCodeURL if the link is valid, otherwise null.
|
410
|
+
*/
|
411
|
+
export function parseActionCodeURL(link: string): FirebaseAuthTypes.ActionCodeURL | null;
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Deletes and signs out the user.
|
415
|
+
*
|
416
|
+
* @param user - The user to delete.
|
417
|
+
* @returns A promise that resolves when the user is deleted.
|
418
|
+
*/
|
419
|
+
export function deleteUser(user: FirebaseAuthTypes.User): Promise<void>;
|
420
|
+
|
421
|
+
/**
|
422
|
+
* Returns a JSON Web Token (JWT) used to identify the user to a Firebase service.
|
423
|
+
*
|
424
|
+
* @param user - The user to get the token for.
|
425
|
+
* @param forceRefresh - Optional. Whether to force refresh the token.
|
426
|
+
* @returns A promise that resolves with the token.
|
427
|
+
*/
|
428
|
+
export function getIdToken(user: FirebaseAuthTypes.User, forceRefresh?: boolean): Promise<string>;
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Returns a deserialized JSON Web Token (JWT) used to identify the user to a Firebase service.
|
432
|
+
*
|
433
|
+
* @param user - The user to get the token result for.
|
434
|
+
* @param forceRefresh - Optional. Whether to force refresh the token.
|
435
|
+
* @returns A promise that resolves with the token result.
|
436
|
+
*/
|
437
|
+
export function getIdTokenResult(
|
438
|
+
user: FirebaseAuthTypes.User,
|
439
|
+
forceRefresh?: boolean,
|
440
|
+
): Promise<FirebaseAuthTypes.IdTokenResult>;
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Links the user account with the given credentials.
|
444
|
+
*
|
445
|
+
* @param user - The user to link the credentials with.
|
446
|
+
* @param credential - The auth credentials.
|
447
|
+
* @returns A promise that resolves with the user credentials.
|
448
|
+
*/
|
449
|
+
export function linkWithCredential(
|
450
|
+
user: FirebaseAuthTypes.User,
|
451
|
+
credential: FirebaseAuthTypes.AuthCredential,
|
452
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
453
|
+
|
454
|
+
/**
|
455
|
+
* Links the user account with the given phone number.
|
456
|
+
*
|
457
|
+
* @param user - The user to link the phone number with.
|
458
|
+
* @param phoneNumber - The phone number.
|
459
|
+
* @param appVerifier - The application verifier.
|
460
|
+
* @returns A promise that resolves with the confirmation result.
|
461
|
+
*/
|
462
|
+
export function linkWithPhoneNumber(
|
463
|
+
user: FirebaseAuthTypes.User,
|
464
|
+
phoneNumber: string,
|
465
|
+
appVerifier: ApplicationVerifier,
|
466
|
+
): Promise<FirebaseAuthTypes.ConfirmationResult>;
|
467
|
+
|
468
|
+
/**
|
469
|
+
* Links the authenticated provider to the user account using a pop-up based OAuth flow.
|
470
|
+
*
|
471
|
+
* @param user - The user to link the provider with.
|
472
|
+
* @param provider - The auth provider.
|
473
|
+
* @param resolver - Optional. The popup redirect resolver.
|
474
|
+
* @returns A promise that resolves with the user credentials.
|
475
|
+
*/
|
476
|
+
export function linkWithPopup(
|
477
|
+
user: FirebaseAuthTypes.User,
|
478
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
479
|
+
resolver?: PopupRedirectResolver,
|
480
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
481
|
+
|
482
|
+
/**
|
483
|
+
* Links the OAuthProvider to the user account using a full-page redirect flow.
|
484
|
+
*
|
485
|
+
* @param user - The user to link the provider with.
|
486
|
+
* @param provider - The auth provider.
|
487
|
+
* @param resolver - Optional. The popup redirect resolver.
|
488
|
+
* @returns A promise that resolves when the redirect is complete.
|
489
|
+
*/
|
490
|
+
export function linkWithRedirect(
|
491
|
+
user: FirebaseAuthTypes.User,
|
492
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
493
|
+
resolver?: PopupRedirectResolver,
|
494
|
+
): Promise<void>;
|
495
|
+
|
496
|
+
/**
|
497
|
+
* The MultiFactorUser corresponding to the user.
|
498
|
+
*
|
499
|
+
* @param user - The user to get the multi-factor user for.
|
500
|
+
* @returns The MultiFactorUser instance.
|
501
|
+
*/
|
502
|
+
export function multiFactor(user: FirebaseAuthTypes.User): FirebaseAuthTypes.MultiFactorUser;
|
503
|
+
|
504
|
+
/**
|
505
|
+
* Re-authenticates a user using a fresh credential.
|
506
|
+
*
|
507
|
+
* @param user - The user to re-authenticate.
|
508
|
+
* @param credential - The auth credentials.
|
509
|
+
* @returns A promise that resolves with the user credentials.
|
510
|
+
*/
|
511
|
+
export function reauthenticateWithCredential(
|
512
|
+
user: FirebaseAuthTypes.User,
|
513
|
+
credential: FirebaseAuthTypes.AuthCredential,
|
514
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Re-authenticates a user using a fresh phone credential.
|
518
|
+
*
|
519
|
+
* @param user - The user to re-authenticate.
|
520
|
+
* @param phoneNumber - The phone number.
|
521
|
+
* @param appVerifier - The application verifier.
|
522
|
+
* @returns A promise that resolves with the confirmation result.
|
523
|
+
*/
|
524
|
+
export function reauthenticateWithPhoneNumber(
|
525
|
+
user: FirebaseAuthTypes.User,
|
526
|
+
phoneNumber: string,
|
527
|
+
appVerifier: ApplicationVerifier,
|
528
|
+
): Promise<FirebaseAuthTypes.ConfirmationResult>;
|
529
|
+
|
530
|
+
/**
|
531
|
+
* Reauthenticates the current user with the specified OAuthProvider using a pop-up based OAuth flow.
|
532
|
+
*
|
533
|
+
* @param user - The user to re-authenticate.
|
534
|
+
* @param provider - The auth provider.
|
535
|
+
* @param resolver - Optional. The popup redirect resolver.
|
536
|
+
* @returns A promise that resolves with the user credentials.
|
537
|
+
*/
|
538
|
+
export function reauthenticateWithPopup(
|
539
|
+
user: FirebaseAuthTypes.User,
|
540
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
541
|
+
resolver?: PopupRedirectResolver,
|
542
|
+
): Promise<FirebaseAuthTypes.UserCredential>;
|
543
|
+
|
544
|
+
/**
|
545
|
+
* Reauthenticates the current user with the specified OAuthProvider using a full-page redirect flow.
|
546
|
+
*
|
547
|
+
* @param user - The user to re-authenticate.
|
548
|
+
* @param provider - The auth provider.
|
549
|
+
* @param resolver - Optional. The popup redirect resolver.
|
550
|
+
* @returns A promise that resolves when the redirect is complete.
|
551
|
+
*/
|
552
|
+
export function reauthenticateWithRedirect(
|
553
|
+
user: FirebaseAuthTypes.User,
|
554
|
+
provider: FirebaseAuthTypes.AuthProvider,
|
555
|
+
resolver?: PopupRedirectResolver,
|
556
|
+
): Promise<void>;
|
557
|
+
|
558
|
+
/**
|
559
|
+
* Reloads user account data, if signed in.
|
560
|
+
*
|
561
|
+
* @param user - The user to reload data for.
|
562
|
+
* @returns A promise that resolves when the data is reloaded.
|
563
|
+
*/
|
564
|
+
export function reload(user: FirebaseAuthTypes.User): Promise<void>;
|
565
|
+
|
566
|
+
/**
|
567
|
+
* Sends a verification email to a user.
|
568
|
+
*
|
569
|
+
* @param user - The user to send the email to.
|
570
|
+
* @param actionCodeSettings - Optional. Action code settings.
|
571
|
+
* @returns A promise that resolves when the email is sent.
|
572
|
+
*/
|
573
|
+
export function sendEmailVerification(
|
574
|
+
user: FirebaseAuthTypes.User,
|
575
|
+
actionCodeSettings?: FirebaseAuthTypes.ActionCodeSettings,
|
576
|
+
): Promise<void>;
|
577
|
+
|
578
|
+
/**
|
579
|
+
* Unlinks a provider from a user account.
|
580
|
+
*
|
581
|
+
* @param user - The user to unlink the provider from.
|
582
|
+
* @param providerId - The provider ID.
|
583
|
+
* @returns A promise that resolves with the user.
|
584
|
+
*/
|
585
|
+
export function unlink(
|
586
|
+
user: FirebaseAuthTypes.User,
|
587
|
+
providerId: string,
|
588
|
+
): Promise<FirebaseAuthTypes.User>;
|
589
|
+
|
590
|
+
/**
|
591
|
+
* Updates the user's email address.
|
592
|
+
*
|
593
|
+
* @param user - The user to update the email for.
|
594
|
+
* @param newEmail - The new email address.
|
595
|
+
* @returns A promise that resolves when the email is updated.
|
596
|
+
*/
|
597
|
+
export function updateEmail(user: FirebaseAuthTypes.User, newEmail: string): Promise<void>;
|
598
|
+
|
599
|
+
/**
|
600
|
+
* Updates the user's password.
|
601
|
+
*
|
602
|
+
* @param user - The user to update the password for.
|
603
|
+
* @param newPassword - The new password.
|
604
|
+
* @returns A promise that resolves when the password is updated.
|
605
|
+
*/
|
606
|
+
export function updatePassword(user: FirebaseAuthTypes.User, newPassword: string): Promise<void>;
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Updates the user's phone number.
|
610
|
+
*
|
611
|
+
* @param user - The user to update the phone number for.
|
612
|
+
* @param credential - The auth credentials.
|
613
|
+
* @returns A promise that resolves when the phone number is updated.
|
614
|
+
*/
|
615
|
+
export function updatePhoneNumber(
|
616
|
+
user: FirebaseAuthTypes.User,
|
617
|
+
credential: FirebaseAuthTypes.AuthCredential,
|
618
|
+
): Promise<void>;
|
619
|
+
|
620
|
+
/**
|
621
|
+
* Updates a user's profile data.
|
622
|
+
*
|
623
|
+
* @param user - The user to update the profile for.
|
624
|
+
* @param profile - An object containing the profile data to update.
|
625
|
+
* @returns A promise that resolves when the profile is updated.
|
626
|
+
*/
|
627
|
+
export function updateProfile(
|
628
|
+
user: FirebaseAuthTypes.User,
|
629
|
+
{ displayName, photoURL: photoUrl }: { displayName?: string | null; photoURL?: string | null },
|
630
|
+
): Promise<void>;
|
631
|
+
|
632
|
+
/**
|
633
|
+
* Sends a verification email to a new email address.
|
634
|
+
*
|
635
|
+
* @param user - The user to send the email to.
|
636
|
+
* @param newEmail - The new email address.
|
637
|
+
* @param actionCodeSettings - Optional. Action code settings.
|
638
|
+
* @returns A promise that resolves when the email is sent.
|
639
|
+
*/
|
640
|
+
export function verifyBeforeUpdateEmail(
|
641
|
+
user: FirebaseAuthTypes.User,
|
642
|
+
newEmail: string,
|
643
|
+
actionCodeSettings?: FirebaseAuthTypes.ActionCodeSettings,
|
644
|
+
): Promise<void>;
|
645
|
+
|
646
|
+
/**
|
647
|
+
* Extracts provider specific AdditionalUserInfo for the given credential.
|
648
|
+
*
|
649
|
+
* @param userCredential - The user credential.
|
650
|
+
* @returns The additional user information, or null if none is available.
|
651
|
+
*/
|
652
|
+
export function getAdditionalUserInfo(
|
653
|
+
userCredential: FirebaseAuthTypes.UserCredential,
|
654
|
+
): FirebaseAuthTypes.AdditionalUserInfo | null;
|
655
|
+
|
656
|
+
/**
|
657
|
+
* Returns the custom auth domain for the auth instance.
|
658
|
+
*
|
659
|
+
* @param auth - The Auth instance.
|
660
|
+
* @returns A promise that resolves with the custom auth domain.
|
661
|
+
*/
|
662
|
+
export function getCustomAuthDomain(auth: Auth): Promise<string>;
|