@firebase/auth 0.21.0 → 0.21.1-20230117221326

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/CHANGELOG.md +11 -0
  2. package/dist/auth-public.d.ts +9 -2
  3. package/dist/auth.d.ts +9 -2
  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-4968b6f1.js} +44 -10
  7. package/dist/cordova/{popup_redirect-b7568081.js.map → popup_redirect-4968b6f1.js.map} +1 -1
  8. package/dist/cordova/src/platform_browser/strategies/redirect.d.ts +9 -2
  9. package/dist/cordova/test/helpers/mock_auth.d.ts +1 -1
  10. package/dist/esm2017/{index-c6def6da.js → index-38b3637d.js} +23 -4
  11. package/dist/esm2017/{index-c6def6da.js.map → index-38b3637d.js.map} +1 -1
  12. package/dist/esm2017/index.js +1 -1
  13. package/dist/esm2017/internal.js +2 -2
  14. package/dist/esm2017/src/platform_browser/strategies/redirect.d.ts +9 -2
  15. package/dist/esm2017/test/helpers/mock_auth.d.ts +1 -1
  16. package/dist/esm5/{index-ef8e1de2.js → index-87c99bef.js} +44 -10
  17. package/dist/esm5/{index-ef8e1de2.js.map → index-87c99bef.js.map} +1 -1
  18. package/dist/esm5/index.js +1 -1
  19. package/dist/esm5/internal.js +2 -2
  20. package/dist/esm5/src/platform_browser/strategies/redirect.d.ts +9 -2
  21. package/dist/esm5/test/helpers/mock_auth.d.ts +1 -1
  22. package/dist/index.webworker.esm5.js +1 -1
  23. package/dist/node/{index-2efb81c0.js → index-b14f3f84.js} +2 -2
  24. package/dist/node/{index-2efb81c0.js.map → index-b14f3f84.js.map} +1 -1
  25. package/dist/node/index.js +1 -1
  26. package/dist/node/internal.js +1 -1
  27. package/dist/node/internal.js.map +1 -1
  28. package/dist/node/src/platform_browser/strategies/redirect.d.ts +9 -2
  29. package/dist/node/test/helpers/mock_auth.d.ts +1 -1
  30. package/dist/node-esm/{index-e0bc98c8.js → index-dd2b9512.js} +2 -2
  31. package/dist/node-esm/{index-e0bc98c8.js.map → index-dd2b9512.js.map} +1 -1
  32. package/dist/node-esm/index.js +1 -1
  33. package/dist/node-esm/internal.js +2 -2
  34. package/dist/node-esm/internal.js.map +1 -1
  35. package/dist/node-esm/src/platform_browser/strategies/redirect.d.ts +9 -2
  36. package/dist/node-esm/test/helpers/mock_auth.d.ts +1 -1
  37. package/dist/rn/index.js +1 -1
  38. package/dist/rn/internal.js +43 -9
  39. package/dist/rn/internal.js.map +1 -1
  40. package/dist/rn/{phone-bc99e0b0.js → phone-f3df5463.js} +2 -2
  41. package/dist/rn/{phone-bc99e0b0.js.map → phone-f3df5463.js.map} +1 -1
  42. package/dist/rn/src/platform_browser/strategies/redirect.d.ts +9 -2
  43. package/dist/rn/test/helpers/mock_auth.d.ts +1 -1
  44. package/dist/src/platform_browser/strategies/redirect.d.ts +9 -2
  45. package/dist/test/helpers/mock_auth.d.ts +1 -1
  46. package/package.json +5 -5
@@ -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;
@@ -8363,6 +8363,7 @@ function pendingRedirectKey(auth) {
8363
8363
  *
8364
8364
  * @remarks
8365
8365
  * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
8366
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link signInWithRedirect}.
8366
8367
  *
8367
8368
  * @example
8368
8369
  * ```javascript
@@ -8403,12 +8404,19 @@ function signInWithRedirect(auth, provider, resolver) {
8403
8404
  async function _signInWithRedirect(auth, provider, resolver) {
8404
8405
  const authInternal = _castAuth(auth);
8405
8406
  _assertInstanceOf(auth, provider, FederatedAuthProvider);
8407
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
8408
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
8409
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
8410
+ await authInternal._initializationPromise;
8406
8411
  const resolverInternal = _withDefaultResolver(authInternal, resolver);
8407
8412
  await _setPendingRedirectStatus(resolverInternal, authInternal);
8408
8413
  return resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */);
8409
8414
  }
8410
8415
  /**
8411
8416
  * Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
8417
+ * @remarks
8418
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
8419
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link reauthenticateWithRedirect}.
8412
8420
  *
8413
8421
  * @example
8414
8422
  * ```javascript
@@ -8419,8 +8427,8 @@ async function _signInWithRedirect(auth, provider, resolver) {
8419
8427
  *
8420
8428
  * // After returning from the redirect when your app initializes you can obtain the result
8421
8429
  * const result = await getRedirectResult(auth);
8422
- * // Link using a redirect.
8423
- * await linkWithRedirect(result.user, provider);
8430
+ * // Reauthenticate using a redirect.
8431
+ * await reauthenticateWithRedirect(result.user, provider);
8424
8432
  * // This will again trigger a full page redirect away from your app
8425
8433
  *
8426
8434
  * // After returning from the redirect when your app initializes you can obtain the result
@@ -8441,6 +8449,10 @@ function reauthenticateWithRedirect(user, provider, resolver) {
8441
8449
  async function _reauthenticateWithRedirect(user, provider, resolver) {
8442
8450
  const userInternal = getModularInstance(user);
8443
8451
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
8452
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
8453
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
8454
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
8455
+ await userInternal.auth._initializationPromise;
8444
8456
  // Allow the resolver to error before persisting the redirect user
8445
8457
  const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
8446
8458
  await _setPendingRedirectStatus(resolverInternal, userInternal.auth);
@@ -8449,6 +8461,9 @@ async function _reauthenticateWithRedirect(user, provider, resolver) {
8449
8461
  }
8450
8462
  /**
8451
8463
  * Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
8464
+ * @remarks
8465
+ * To handle the results and errors for this operation, refer to {@link getRedirectResult}.
8466
+ * Follow the [best practices](https://firebase.google.com/docs/auth/web/redirect-best-practices) when using {@link linkWithRedirect}.
8452
8467
  *
8453
8468
  * @example
8454
8469
  * ```javascript
@@ -8478,6 +8493,10 @@ function linkWithRedirect(user, provider, resolver) {
8478
8493
  async function _linkWithRedirect(user, provider, resolver) {
8479
8494
  const userInternal = getModularInstance(user);
8480
8495
  _assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
8496
+ // Wait for auth initialization to complete, this will process pending redirects and clear the
8497
+ // PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
8498
+ // redirect and creating a PENDING_REDIRECT_KEY entry.
8499
+ await userInternal.auth._initializationPromise;
8481
8500
  // Allow the resolver to error before persisting the redirect user
8482
8501
  const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
8483
8502
  await _assertLinkedStatus(false, userInternal, provider.providerId);
@@ -9289,7 +9308,7 @@ class PhoneMultiFactorGenerator {
9289
9308
  PhoneMultiFactorGenerator.FACTOR_ID = 'phone';
9290
9309
 
9291
9310
  var name = "@firebase/auth";
9292
- var version = "0.21.0";
9311
+ var version = "0.21.1-20230117221326";
9293
9312
 
9294
9313
  /**
9295
9314
  * @license
@@ -9515,4 +9534,4 @@ function getAuth(app = getApp()) {
9515
9534
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
9516
9535
 
9517
9536
  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, _getRedirectResult as aB, _overrideRedirectResult as aC, _clearRedirectOutcomes 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, debugAssert as ap, _isIOS as aq, _isAndroid as ar, _fail as as, _getRedirectUrl as at, _getProjectConfig as au, _isIOS7Or8 as av, _createError as aw, _assert 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 };
9518
- //# sourceMappingURL=index-c6def6da.js.map
9537
+ //# sourceMappingURL=index-38b3637d.js.map