@firebase/auth 0.21.0 → 0.21.1-canary.68369740a

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 (58) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/auth-public.d.ts +11 -3
  3. package/dist/auth.d.ts +11 -3
  4. package/dist/cordova/index.js +2 -2
  5. package/dist/cordova/internal.js +2 -2
  6. package/dist/cordova/{popup_redirect-b7568081.js → popup_redirect-616e0b14.js} +52 -20
  7. package/dist/cordova/popup_redirect-616e0b14.js.map +1 -0
  8. package/dist/cordova/src/core/strategies/credential.d.ts +2 -1
  9. package/dist/cordova/src/platform_browser/strategies/redirect.d.ts +9 -2
  10. package/dist/cordova/test/helpers/mock_auth.d.ts +1 -1
  11. package/dist/esm2017/{index-c6def6da.js → index-af761b12.js} +37 -19
  12. package/dist/esm2017/index-af761b12.js.map +1 -0
  13. package/dist/esm2017/index.js +1 -1
  14. package/dist/esm2017/internal.js +2 -2
  15. package/dist/esm2017/src/core/strategies/credential.d.ts +2 -1
  16. package/dist/esm2017/src/platform_browser/strategies/redirect.d.ts +9 -2
  17. package/dist/esm2017/test/helpers/mock_auth.d.ts +1 -1
  18. package/dist/esm5/{index-ef8e1de2.js → index-4e4377a9.js} +52 -20
  19. package/dist/esm5/index-4e4377a9.js.map +1 -0
  20. package/dist/esm5/index.js +1 -1
  21. package/dist/esm5/internal.js +2 -2
  22. package/dist/esm5/src/core/strategies/credential.d.ts +2 -1
  23. package/dist/esm5/src/platform_browser/strategies/redirect.d.ts +9 -2
  24. package/dist/esm5/test/helpers/mock_auth.d.ts +1 -1
  25. package/dist/index.webworker.esm5.js +9 -11
  26. package/dist/index.webworker.esm5.js.map +1 -1
  27. package/dist/node/{index-2efb81c0.js → index-edd1794a.js} +10 -12
  28. package/dist/node/{index-2efb81c0.js.map → index-edd1794a.js.map} +1 -1
  29. package/dist/node/index.js +1 -1
  30. package/dist/node/internal.js +1 -1
  31. package/dist/node/internal.js.map +1 -1
  32. package/dist/node/src/core/strategies/credential.d.ts +2 -1
  33. package/dist/node/src/platform_browser/strategies/redirect.d.ts +9 -2
  34. package/dist/node/test/helpers/mock_auth.d.ts +1 -1
  35. package/dist/node-esm/{index-e0bc98c8.js → index-d458390f.js} +16 -17
  36. package/dist/node-esm/{index-e0bc98c8.js.map → index-d458390f.js.map} +1 -1
  37. package/dist/node-esm/index.js +1 -1
  38. package/dist/node-esm/internal.js +2 -2
  39. package/dist/node-esm/internal.js.map +1 -1
  40. package/dist/node-esm/src/core/strategies/credential.d.ts +2 -1
  41. package/dist/node-esm/src/platform_browser/strategies/redirect.d.ts +9 -2
  42. package/dist/node-esm/test/helpers/mock_auth.d.ts +1 -1
  43. package/dist/rn/index.js +1 -1
  44. package/dist/rn/internal.js +43 -9
  45. package/dist/rn/internal.js.map +1 -1
  46. package/dist/rn/{phone-bc99e0b0.js → phone-8afa33ea.js} +10 -12
  47. package/dist/rn/phone-8afa33ea.js.map +1 -0
  48. package/dist/rn/src/core/strategies/credential.d.ts +2 -1
  49. package/dist/rn/src/platform_browser/strategies/redirect.d.ts +9 -2
  50. package/dist/rn/test/helpers/mock_auth.d.ts +1 -1
  51. package/dist/src/core/strategies/credential.d.ts +2 -1
  52. package/dist/src/platform_browser/strategies/redirect.d.ts +9 -2
  53. package/dist/test/helpers/mock_auth.d.ts +1 -1
  54. package/package.json +6 -6
  55. package/dist/cordova/popup_redirect-b7568081.js.map +0 -1
  56. package/dist/esm2017/index-c6def6da.js.map +0 -1
  57. package/dist/esm5/index-ef8e1de2.js.map +0 -1
  58. package/dist/rn/phone-bc99e0b0.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-c6def6da.js';
1
+ export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-af761b12.js';
2
2
  import '@firebase/util';
3
3
  import '@firebase/app';
4
4
  import '@firebase/logger';
@@ -1,5 +1,5 @@
1
- import { ap as debugAssert, aq as _isIOS, ar as _isAndroid, as as _fail, at as _getRedirectUrl, au as _getProjectConfig, av as _isIOS7Or8, aw as _createError, ax as _assert, ay as AuthEventManager, az as _getInstance, b as browserLocalPersistence, aA as _persistenceKeyName, a as browserSessionPersistence, aB as _getRedirectResult, aC as _overrideRedirectResult, aD as _clearRedirectOutcomes, aE as _castAuth } from './index-c6def6da.js';
2
- export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, aG as AuthImpl, aJ as AuthPopup, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, aK as FetchProvider, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aL as SAMLAuthCredential, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, aF as UserImpl, ax as _assert, aE as _castAuth, as as _fail, aI as _generateEventId, aH as _getClientVersion, az as _getInstance, aB as _getRedirectResult, aC as _overrideRedirectResult, aA as _persistenceKeyName, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-c6def6da.js';
1
+ import { ap as debugAssert, aq as _isIOS, ar as _isAndroid, as as _fail, at as _getRedirectUrl, au as _getProjectConfig, av as _isIOS7Or8, aw as _createError, ax as _assert, ay as AuthEventManager, az as _getInstance, b as browserLocalPersistence, aA as _persistenceKeyName, a as browserSessionPersistence, aB as _getRedirectResult, aC as _overrideRedirectResult, aD as _clearRedirectOutcomes, aE as _castAuth } from './index-af761b12.js';
2
+ export { A as ActionCodeOperation, ad as ActionCodeURL, H as AuthCredential, D as AuthErrorCodes, aG as AuthImpl, aJ as AuthPopup, I as EmailAuthCredential, M as EmailAuthProvider, N as FacebookAuthProvider, F as FactorId, aK as FetchProvider, T as GithubAuthProvider, Q as GoogleAuthProvider, J as OAuthCredential, U as OAuthProvider, O as OperationType, K as PhoneAuthCredential, P as PhoneAuthProvider, m as PhoneMultiFactorGenerator, o as ProviderId, R as RecaptchaVerifier, aL as SAMLAuthCredential, V as SAMLAuthProvider, S as SignInMethod, W as TwitterAuthProvider, aF as UserImpl, ax as _assert, aE as _castAuth, as as _fail, aI as _generateEventId, aH as _getClientVersion, az as _getInstance, aB as _getRedirectResult, aC as _overrideRedirectResult, aA as _persistenceKeyName, a2 as applyActionCode, t as beforeAuthStateChanged, b as browserLocalPersistence, k as browserPopupRedirectResolver, a as browserSessionPersistence, a3 as checkActionCode, a1 as confirmPasswordReset, G as connectAuthEmulator, a5 as createUserWithEmailAndPassword, B as debugErrorMap, z as deleteUser, aa as fetchSignInMethodsForEmail, al as getAdditionalUserInfo, n as getAuth, ai as getIdToken, aj as getIdTokenResult, an as getMultiFactorResolver, j as getRedirectResult, L as inMemoryPersistence, i as indexedDBLocalPersistence, E as initializeAuth, a8 as isSignInWithEmailLink, Z as linkWithCredential, l as linkWithPhoneNumber, d as linkWithPopup, g as linkWithRedirect, ao as multiFactor, v as onAuthStateChanged, q as onIdTokenChanged, ae as parseActionCodeURL, C as prodErrorMap, _ as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, e as reauthenticateWithPopup, h as reauthenticateWithRedirect, am as reload, ab as sendEmailVerification, a0 as sendPasswordResetEmail, a7 as sendSignInLinkToEmail, p as setPersistence, X as signInAnonymously, Y as signInWithCredential, $ as signInWithCustomToken, a6 as signInWithEmailAndPassword, a9 as signInWithEmailLink, s as signInWithPhoneNumber, c as signInWithPopup, f as signInWithRedirect, y as signOut, ak as unlink, x as updateCurrentUser, ag as updateEmail, ah as updatePassword, u as updatePhoneNumber, af as updateProfile, w as useDeviceLanguage, ac as verifyBeforeUpdateEmail, a4 as verifyPasswordResetCode } from './index-af761b12.js';
3
3
  import { querystringDecode } from '@firebase/util';
4
4
  import '@firebase/app';
5
5
  import '@firebase/logger';
@@ -47,7 +47,8 @@ export declare function linkWithCredential(user: User, credential: AuthCredentia
47
47
  *
48
48
  * @remarks
49
49
  * Use before operations such as {@link updatePassword} that require tokens from recent sign-in
50
- * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error.
50
+ * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
51
+ * or a `TOKEN_EXPIRED` error.
51
52
  *
52
53
  * @param user - The user.
53
54
  * @param credential - The auth credential.
@@ -20,6 +20,7 @@ import { Auth, AuthProvider, PopupRedirectResolver, User, UserCredential } from
20
20
  *
21
21
  * @remarks
22
22
  * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
23
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link signInWithRedirect}.
23
24
  *
24
25
  * @example
25
26
  * ```javascript
@@ -58,6 +59,9 @@ export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, r
58
59
  export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>;
59
60
  /**
60
61
  * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
62
+ * @remarks
63
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
64
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link reauthenticateWithRedirect}.
61
65
  *
62
66
  * @example
63
67
  * ```javascript
@@ -68,8 +72,8 @@ export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider,
68
72
  *
69
73
  * // After returning from the redirect when your app initializes you can obtain the result
70
74
  * const result = await getRedirectResult(auth);
71
- * // Link using a redirect.
72
- * await linkWithRedirect(result.user, provider);
75
+ * // Reauthenticate using a redirect.
76
+ * await reauthenticateWithRedirect(result.user, provider);
73
77
  * // This will again trigger a full page redirect away from your app
74
78
  *
75
79
  * // After returning from the redirect when your app initializes you can obtain the result
@@ -88,6 +92,9 @@ export declare function reauthenticateWithRedirect(user: User, provider: AuthPro
88
92
  export declare function _reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>;
89
93
  /**
90
94
  * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
95
+ * @remarks
96
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
97
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link linkWithRedirect}.
91
98
  *
92
99
  * @example
93
100
  * ```javascript
@@ -38,5 +38,5 @@ export declare class MockPersistenceLayer extends InMemoryPersistence {
38
38
  _set(key: string, object: PersistedBlob): Promise<void>;
39
39
  _remove(key: string): Promise<void>;
40
40
  }
41
- export declare function testAuth(popupRedirectResolver?: PopupRedirectResolver, persistence?: MockPersistenceLayer): Promise<TestAuth>;
41
+ export declare function testAuth(popupRedirectResolver?: PopupRedirectResolver, persistence?: MockPersistenceLayer, skipAwaitOnInit?: boolean): Promise<TestAuth>;
42
42
  export declare function testUser(auth: AuthInternal, uid: string, email?: string, fakeTokens?: boolean): UserInternal;
@@ -5572,7 +5572,8 @@ function linkWithCredential(user, credential) {
5572
5572
  *
5573
5573
  * @remarks
5574
5574
  * Use before operations such as {@link updatePassword} that require tokens from recent sign-in
5575
- * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error.
5575
+ * attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
5576
+ * or a `TOKEN_EXPIRED` error.
5576
5577
  *
5577
5578
  * @param user - The user.
5578
5579
  * @param credential - The auth credential.
@@ -7009,11 +7010,14 @@ var MultiFactorUserImpl = /** @class */ (function () {
7009
7010
  return [4 /*yield*/, this.user.getIdToken()];
7010
7011
  case 1:
7011
7012
  idToken = _a.sent();
7013
+ _a.label = 2;
7014
+ case 2:
7015
+ _a.trys.push([2, 6, , 7]);
7012
7016
  return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
7013
7017
  idToken: idToken,
7014
7018
  mfaEnrollmentId: mfaEnrollmentId
7015
7019
  }))];
7016
- case 2:
7020
+ case 3:
7017
7021
  idTokenResponse = _a.sent();
7018
7022
  // Remove the second factor from the user's list.
7019
7023
  this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
@@ -7025,25 +7029,19 @@ var MultiFactorUserImpl = /** @class */ (function () {
7025
7029
  // are now invalid), reloading the user will discover this and invalidate
7026
7030
  // the user's state accordingly.
7027
7031
  return [4 /*yield*/, this.user._updateTokensIfNecessary(idTokenResponse)];
7028
- case 3:
7032
+ case 4:
7029
7033
  // Depending on whether the backend decided to revoke the user's session,
7030
7034
  // the tokenResponse may be empty. If the tokens were not updated (and they
7031
7035
  // are now invalid), reloading the user will discover this and invalidate
7032
7036
  // the user's state accordingly.
7033
7037
  _a.sent();
7034
- _a.label = 4;
7035
- case 4:
7036
- _a.trys.push([4, 6, , 7]);
7037
7038
  return [4 /*yield*/, this.user.reload()];
7038
7039
  case 5:
7039
7040
  _a.sent();
7040
7041
  return [3 /*break*/, 7];
7041
7042
  case 6:
7042
7043
  e_1 = _a.sent();
7043
- if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
7044
- throw e_1;
7045
- }
7046
- return [3 /*break*/, 7];
7044
+ throw e_1;
7047
7045
  case 7: return [2 /*return*/];
7048
7046
  }
7049
7047
  });
@@ -9989,6 +9987,7 @@ function pendingRedirectKey(auth) {
9989
9987
  *
9990
9988
  * @remarks
9991
9989
  * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
9990
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link signInWithRedirect}.
9992
9991
  *
9993
9992
  * @example
9994
9993
  * ```javascript
@@ -10034,9 +10033,18 @@ function _signInWithRedirect(auth, provider, resolver) {
10034
10033
  case 0:
10035
10034
  authInternal = _castAuth(auth);
10036
10035
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
10036
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10037
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10038
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10039
+ return [4 /*yield*/, authInternal._initializationPromise];
10040
+ case 1:
10041
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10042
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10043
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10044
+ _a.sent();
10037
10045
  resolverInternal = _withDefaultResolver(authInternal, resolver);
10038
10046
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, authInternal)];
10039
- case 1:
10047
+ case 2:
10040
10048
  _a.sent();
10041
10049
  return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */)];
10042
10050
  }
@@ -10045,6 +10053,9 @@ function _signInWithRedirect(auth, provider, resolver) {
10045
10053
  }
10046
10054
  /**
10047
10055
  * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
10056
+ * @remarks
10057
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
10058
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link reauthenticateWithRedirect}.
10048
10059
  *
10049
10060
  * @example
10050
10061
  * ```javascript
@@ -10055,8 +10066,8 @@ function _signInWithRedirect(auth, provider, resolver) {
10055
10066
  *
10056
10067
  * // After returning from the redirect when your app initializes you can obtain the result
10057
10068
  * const result = await getRedirectResult(auth);
10058
- * // Link using a redirect.
10059
- * await linkWithRedirect(result.user, provider);
10069
+ * // Reauthenticate using a redirect.
10070
+ * await reauthenticateWithRedirect(result.user, provider);
10060
10071
  * // This will again trigger a full page redirect away from your app
10061
10072
  *
10062
10073
  * // After returning from the redirect when your app initializes you can obtain the result
@@ -10082,12 +10093,21 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
10082
10093
  case 0:
10083
10094
  userInternal = getModularInstance(user);
10084
10095
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
10096
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10097
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10098
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10099
+ return [4 /*yield*/, userInternal.auth._initializationPromise];
10100
+ case 1:
10101
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10102
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10103
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10104
+ _a.sent();
10085
10105
  resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
10086
10106
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
10087
- case 1:
10107
+ case 2:
10088
10108
  _a.sent();
10089
10109
  return [4 /*yield*/, prepareUserForRedirect(userInternal)];
10090
- case 2:
10110
+ case 3:
10091
10111
  eventId = _a.sent();
10092
10112
  return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId)];
10093
10113
  }
@@ -10096,6 +10116,9 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
10096
10116
  }
10097
10117
  /**
10098
10118
  * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
10119
+ * @remarks
10120
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
10121
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link linkWithRedirect}.
10099
10122
  *
10100
10123
  * @example
10101
10124
  * ```javascript
@@ -10130,15 +10153,24 @@ function _linkWithRedirect(user, provider, resolver) {
10130
10153
  case 0:
10131
10154
  userInternal = getModularInstance(user);
10132
10155
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
10156
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10157
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10158
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10159
+ return [4 /*yield*/, userInternal.auth._initializationPromise];
10160
+ case 1:
10161
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10162
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10163
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10164
+ _a.sent();
10133
10165
  resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
10134
10166
  return [4 /*yield*/, _assertLinkedStatus(false, userInternal, provider.providerId)];
10135
- case 1:
10167
+ case 2:
10136
10168
  _a.sent();
10137
10169
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
10138
- case 2:
10170
+ case 3:
10139
10171
  _a.sent();
10140
10172
  return [4 /*yield*/, prepareUserForRedirect(userInternal)];
10141
- case 3:
10173
+ case 4:
10142
10174
  eventId = _a.sent();
10143
10175
  return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId)];
10144
10176
  }
@@ -11065,7 +11097,7 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
11065
11097
  }());
11066
11098
 
11067
11099
  var name = "@firebase/auth";
11068
- var version = "0.21.0";
11100
+ var version = "0.21.1-canary.68369740a";
11069
11101
 
11070
11102
  /**
11071
11103
  * @license
@@ -11323,4 +11355,4 @@ function getAuth(app) {
11323
11355
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
11324
11356
 
11325
11357
  export { signInWithCustomToken as $, ActionCodeOperation as A, debugErrorMap as B, prodErrorMap as C, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as D, initializeAuth as E, FactorId as F, connectAuthEmulator as G, AuthCredential as H, EmailAuthCredential as I, OAuthCredential as J, PhoneAuthCredential as K, inMemoryPersistence as L, EmailAuthProvider as M, FacebookAuthProvider as N, OperationType as O, PhoneAuthProvider as P, GoogleAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, GithubAuthProvider as T, OAuthProvider as U, SAMLAuthProvider as V, TwitterAuthProvider as W, signInAnonymously as X, signInWithCredential as Y, linkWithCredential as Z, reauthenticateWithCredential as _, browserSessionPersistence as a, sendPasswordResetEmail as a0, confirmPasswordReset as a1, applyActionCode as a2, checkActionCode as a3, verifyPasswordResetCode as a4, createUserWithEmailAndPassword as a5, signInWithEmailAndPassword as a6, sendSignInLinkToEmail as a7, isSignInWithEmailLink as a8, signInWithEmailLink as a9, _persistenceKeyName as aA, _clearRedirectOutcomes as aB, _getRedirectResult as aC, _overrideRedirectResult as aD, _castAuth as aE, UserImpl as aF, AuthImpl as aG, _getClientVersion as aH, _generateEventId as aI, AuthPopup as aJ, FetchProvider as aK, SAMLAuthCredential as aL, fetchSignInMethodsForEmail as aa, sendEmailVerification as ab, verifyBeforeUpdateEmail as ac, ActionCodeURL as ad, parseActionCodeURL as ae, updateProfile as af, updateEmail as ag, updatePassword as ah, getIdToken as ai, getIdTokenResult as aj, unlink as ak, getAdditionalUserInfo as al, reload as am, getMultiFactorResolver as an, multiFactor as ao, _isIOS as ap, _isAndroid as aq, _fail as ar, _getRedirectUrl as as, debugAssert as at, _getProjectConfig as au, _isIOS7Or8 as av, _assert as aw, _createError as ax, AuthEventManager as ay, _getInstance as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, getAuth as n, ProviderId as o, setPersistence as p, onIdTokenChanged as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, beforeAuthStateChanged as t, updatePhoneNumber as u, onAuthStateChanged as v, useDeviceLanguage as w, updateCurrentUser as x, signOut as y, deleteUser as z };
11326
- //# sourceMappingURL=index-ef8e1de2.js.map
11358
+ //# sourceMappingURL=index-4e4377a9.js.map