@firebase/auth 0.21.0 → 0.21.1-canary.27b5e7d70

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 +14 -3
  3. package/dist/auth.d.ts +14 -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-100145d2.js} +55 -20
  7. package/dist/cordova/popup_redirect-100145d2.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 +12 -2
  10. package/dist/cordova/test/helpers/mock_auth.d.ts +1 -1
  11. package/dist/esm2017/{index-c6def6da.js → index-8b268dcc.js} +40 -19
  12. package/dist/esm2017/index-8b268dcc.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 +12 -2
  17. package/dist/esm2017/test/helpers/mock_auth.d.ts +1 -1
  18. package/dist/esm5/{index-ef8e1de2.js → index-d0f42d93.js} +55 -20
  19. package/dist/esm5/index-d0f42d93.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 +12 -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-8f4e9d92.js} +10 -12
  28. package/dist/node/{index-2efb81c0.js.map → index-8f4e9d92.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 +12 -2
  34. package/dist/node/test/helpers/mock_auth.d.ts +1 -1
  35. package/dist/node-esm/{index-e0bc98c8.js → index-fe3db70f.js} +16 -17
  36. package/dist/node-esm/{index-e0bc98c8.js.map → index-fe3db70f.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 +12 -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 +46 -9
  45. package/dist/rn/internal.js.map +1 -1
  46. package/dist/rn/{phone-bc99e0b0.js → phone-edfc46b9.js} +10 -12
  47. package/dist/rn/phone-edfc46b9.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 +12 -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 +12 -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-8b268dcc.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-8b268dcc.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-8b268dcc.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,8 @@ 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 {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
24
+ * | best practices} when using {@link signInWithRedirect}.
23
25
  *
24
26
  * @example
25
27
  * ```javascript
@@ -58,6 +60,10 @@ export declare function signInWithRedirect(auth: Auth, provider: AuthProvider, r
58
60
  export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>;
59
61
  /**
60
62
  * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
63
+ * @remarks
64
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
65
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
66
+ * | best practices} when using {@link reauthenticateWithRedirect}.
61
67
  *
62
68
  * @example
63
69
  * ```javascript
@@ -68,8 +74,8 @@ export declare function _signInWithRedirect(auth: Auth, provider: AuthProvider,
68
74
  *
69
75
  * // After returning from the redirect when your app initializes you can obtain the result
70
76
  * const result = await getRedirectResult(auth);
71
- * // Link using a redirect.
72
- * await linkWithRedirect(result.user, provider);
77
+ * // Reauthenticate using a redirect.
78
+ * await reauthenticateWithRedirect(result.user, provider);
73
79
  * // This will again trigger a full page redirect away from your app
74
80
  *
75
81
  * // After returning from the redirect when your app initializes you can obtain the result
@@ -88,6 +94,10 @@ export declare function reauthenticateWithRedirect(user: User, provider: AuthPro
88
94
  export declare function _reauthenticateWithRedirect(user: User, provider: AuthProvider, resolver?: PopupRedirectResolver): Promise<void | never>;
89
95
  /**
90
96
  * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
97
+ * @remarks
98
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
99
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
100
+ * | best practices} when using {@link linkWithRedirect}.
91
101
  *
92
102
  * @example
93
103
  * ```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,8 @@ 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 {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
9991
+ * | best practices} when using {@link signInWithRedirect}.
9992
9992
  *
9993
9993
  * @example
9994
9994
  * ```javascript
@@ -10034,9 +10034,18 @@ function _signInWithRedirect(auth, provider, resolver) {
10034
10034
  case 0:
10035
10035
  authInternal = _castAuth(auth);
10036
10036
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
10037
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10038
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10039
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10040
+ return [4 /*yield*/, authInternal._initializationPromise];
10041
+ case 1:
10042
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10043
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10044
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10045
+ _a.sent();
10037
10046
  resolverInternal = _withDefaultResolver(authInternal, resolver);
10038
10047
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, authInternal)];
10039
- case 1:
10048
+ case 2:
10040
10049
  _a.sent();
10041
10050
  return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */)];
10042
10051
  }
@@ -10045,6 +10054,10 @@ function _signInWithRedirect(auth, provider, resolver) {
10045
10054
  }
10046
10055
  /**
10047
10056
  * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
10057
+ * @remarks
10058
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
10059
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
10060
+ * | best practices} when using {@link reauthenticateWithRedirect}.
10048
10061
  *
10049
10062
  * @example
10050
10063
  * ```javascript
@@ -10055,8 +10068,8 @@ function _signInWithRedirect(auth, provider, resolver) {
10055
10068
  *
10056
10069
  * // After returning from the redirect when your app initializes you can obtain the result
10057
10070
  * const result = await getRedirectResult(auth);
10058
- * // Link using a redirect.
10059
- * await linkWithRedirect(result.user, provider);
10071
+ * // Reauthenticate using a redirect.
10072
+ * await reauthenticateWithRedirect(result.user, provider);
10060
10073
  * // This will again trigger a full page redirect away from your app
10061
10074
  *
10062
10075
  * // After returning from the redirect when your app initializes you can obtain the result
@@ -10082,12 +10095,21 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
10082
10095
  case 0:
10083
10096
  userInternal = getModularInstance(user);
10084
10097
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
10098
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10099
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10100
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10101
+ return [4 /*yield*/, userInternal.auth._initializationPromise];
10102
+ case 1:
10103
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10104
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10105
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10106
+ _a.sent();
10085
10107
  resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
10086
10108
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
10087
- case 1:
10109
+ case 2:
10088
10110
  _a.sent();
10089
10111
  return [4 /*yield*/, prepareUserForRedirect(userInternal)];
10090
- case 2:
10112
+ case 3:
10091
10113
  eventId = _a.sent();
10092
10114
  return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId)];
10093
10115
  }
@@ -10096,6 +10118,10 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
10096
10118
  }
10097
10119
  /**
10098
10120
  * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
10121
+ * @remarks
10122
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
10123
+ * Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
10124
+ * | best practices} when using {@link linkWithRedirect}.
10099
10125
  *
10100
10126
  * @example
10101
10127
  * ```javascript
@@ -10130,15 +10156,24 @@ function _linkWithRedirect(user, provider, resolver) {
10130
10156
  case 0:
10131
10157
  userInternal = getModularInstance(user);
10132
10158
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
10159
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10160
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10161
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10162
+ return [4 /*yield*/, userInternal.auth._initializationPromise];
10163
+ case 1:
10164
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
10165
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
10166
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
10167
+ _a.sent();
10133
10168
  resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
10134
10169
  return [4 /*yield*/, _assertLinkedStatus(false, userInternal, provider.providerId)];
10135
- case 1:
10170
+ case 2:
10136
10171
  _a.sent();
10137
10172
  return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, userInternal.auth)];
10138
- case 2:
10173
+ case 3:
10139
10174
  _a.sent();
10140
10175
  return [4 /*yield*/, prepareUserForRedirect(userInternal)];
10141
- case 3:
10176
+ case 4:
10142
10177
  eventId = _a.sent();
10143
10178
  return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId)];
10144
10179
  }
@@ -11065,7 +11100,7 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
11065
11100
  }());
11066
11101
 
11067
11102
  var name = "@firebase/auth";
11068
- var version = "0.21.0";
11103
+ var version = "0.21.1-canary.27b5e7d70";
11069
11104
 
11070
11105
  /**
11071
11106
  * @license
@@ -11323,4 +11358,4 @@ function getAuth(app) {
11323
11358
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
11324
11359
 
11325
11360
  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
11361
+ //# sourceMappingURL=index-d0f42d93.js.map