@firebase/auth 1.4.0 → 1.5.0-20231120214520

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 (80) hide show
  1. package/dist/auth-public.d.ts +14 -2
  2. package/dist/auth.d.ts +15 -3
  3. package/dist/browser-cjs/{index-3d1ff45e.js → index-51eb0fe5.js} +23 -8
  4. package/dist/browser-cjs/index-51eb0fe5.js.map +1 -0
  5. package/dist/browser-cjs/index.js +1 -1
  6. package/dist/browser-cjs/internal.js +1 -1
  7. package/dist/browser-cjs/src/api/errors.d.ts +1 -0
  8. package/dist/browser-cjs/src/core/errors.d.ts +2 -1
  9. package/dist/browser-cjs/src/core/strategies/email.d.ts +5 -1
  10. package/dist/browser-cjs/src/core/strategies/email_and_password.d.ts +5 -1
  11. package/dist/browser-cjs/src/core/user/account_info.d.ts +3 -0
  12. package/dist/cordova/index.js +2 -2
  13. package/dist/cordova/internal.js +2 -2
  14. package/dist/cordova/{popup_redirect-73b8b0b9.js → popup_redirect-4157fc14.js} +23 -8
  15. package/dist/cordova/popup_redirect-4157fc14.js.map +1 -0
  16. package/dist/cordova/src/api/errors.d.ts +1 -0
  17. package/dist/cordova/src/core/errors.d.ts +2 -1
  18. package/dist/cordova/src/core/strategies/email.d.ts +5 -1
  19. package/dist/cordova/src/core/strategies/email_and_password.d.ts +5 -1
  20. package/dist/cordova/src/core/user/account_info.d.ts +3 -0
  21. package/dist/esm2017/{index-61e5ac61.js → index-50a157a9.js} +23 -8
  22. package/dist/esm2017/index-50a157a9.js.map +1 -0
  23. package/dist/esm2017/index.js +1 -1
  24. package/dist/esm2017/internal.js +2 -2
  25. package/dist/esm2017/src/api/errors.d.ts +1 -0
  26. package/dist/esm2017/src/core/errors.d.ts +2 -1
  27. package/dist/esm2017/src/core/strategies/email.d.ts +5 -1
  28. package/dist/esm2017/src/core/strategies/email_and_password.d.ts +5 -1
  29. package/dist/esm2017/src/core/user/account_info.d.ts +3 -0
  30. package/dist/esm5/{index-22a88599.js → index-2922edb2.js} +23 -8
  31. package/dist/esm5/index-2922edb2.js.map +1 -0
  32. package/dist/esm5/index.js +1 -1
  33. package/dist/esm5/internal.js +2 -2
  34. package/dist/esm5/src/api/errors.d.ts +1 -0
  35. package/dist/esm5/src/core/errors.d.ts +2 -1
  36. package/dist/esm5/src/core/strategies/email.d.ts +5 -1
  37. package/dist/esm5/src/core/strategies/email_and_password.d.ts +5 -1
  38. package/dist/esm5/src/core/user/account_info.d.ts +3 -0
  39. package/dist/index.webworker.esm5.js +22 -7
  40. package/dist/index.webworker.esm5.js.map +1 -1
  41. package/dist/node/index.js +2 -2
  42. package/dist/node/internal.js +2 -2
  43. package/dist/node/src/api/errors.d.ts +1 -0
  44. package/dist/node/src/core/errors.d.ts +2 -1
  45. package/dist/node/src/core/strategies/email.d.ts +5 -1
  46. package/dist/node/src/core/strategies/email_and_password.d.ts +5 -1
  47. package/dist/node/src/core/user/account_info.d.ts +3 -0
  48. package/dist/node/{totp-d9065ba0.js → totp-bad12bf6.js} +25 -30
  49. package/dist/node/totp-bad12bf6.js.map +1 -0
  50. package/dist/node-esm/index.js +2 -2
  51. package/dist/node-esm/internal.js +3 -3
  52. package/dist/node-esm/src/api/errors.d.ts +1 -0
  53. package/dist/node-esm/src/core/errors.d.ts +2 -1
  54. package/dist/node-esm/src/core/strategies/email.d.ts +5 -1
  55. package/dist/node-esm/src/core/strategies/email_and_password.d.ts +5 -1
  56. package/dist/node-esm/src/core/user/account_info.d.ts +3 -0
  57. package/dist/node-esm/{totp-d54b05d9.js → totp-668ca5f4.js} +25 -10
  58. package/dist/node-esm/totp-668ca5f4.js.map +1 -0
  59. package/dist/rn/{index-afa362da.js → index-4059ee6a.js} +23 -8
  60. package/dist/rn/index-4059ee6a.js.map +1 -0
  61. package/dist/rn/index.js +1 -1
  62. package/dist/rn/internal.js +1 -1
  63. package/dist/rn/src/api/errors.d.ts +1 -0
  64. package/dist/rn/src/core/errors.d.ts +2 -1
  65. package/dist/rn/src/core/strategies/email.d.ts +5 -1
  66. package/dist/rn/src/core/strategies/email_and_password.d.ts +5 -1
  67. package/dist/rn/src/core/user/account_info.d.ts +3 -0
  68. package/dist/src/api/errors.d.ts +1 -0
  69. package/dist/src/core/errors.d.ts +2 -1
  70. package/dist/src/core/strategies/email.d.ts +5 -1
  71. package/dist/src/core/strategies/email_and_password.d.ts +5 -1
  72. package/dist/src/core/user/account_info.d.ts +3 -0
  73. package/package.json +2 -2
  74. package/dist/browser-cjs/index-3d1ff45e.js.map +0 -1
  75. package/dist/cordova/popup_redirect-73b8b0b9.js.map +0 -1
  76. package/dist/esm2017/index-61e5ac61.js.map +0 -1
  77. package/dist/esm5/index-22a88599.js.map +0 -1
  78. package/dist/node/totp-d9065ba0.js.map +0 -1
  79. package/dist/node-esm/totp-d54b05d9.js.map +0 -1
  80. package/dist/rn/index-afa362da.js.map +0 -1
@@ -42,6 +42,7 @@ export declare const enum ServerError {
42
42
  INVALID_ID_TOKEN = "INVALID_ID_TOKEN",
43
43
  INVALID_IDP_RESPONSE = "INVALID_IDP_RESPONSE",
44
44
  INVALID_IDENTIFIER = "INVALID_IDENTIFIER",
45
+ INVALID_LOGIN_CREDENTIALS = "INVALID_LOGIN_CREDENTIALS",
45
46
  INVALID_MESSAGE_PAYLOAD = "INVALID_MESSAGE_PAYLOAD",
46
47
  INVALID_MFA_PENDING_CREDENTIAL = "INVALID_MFA_PENDING_CREDENTIAL",
47
48
  INVALID_OAUTH_CLIENT_ID = "INVALID_OAUTH_CLIENT_ID",
@@ -57,7 +57,7 @@ export declare const enum AuthErrorCode {
57
57
  INVALID_DYNAMIC_LINK_DOMAIN = "invalid-dynamic-link-domain",
58
58
  INVALID_EMAIL = "invalid-email",
59
59
  INVALID_EMULATOR_SCHEME = "invalid-emulator-scheme",
60
- INVALID_IDP_RESPONSE = "invalid-credential",
60
+ INVALID_CREDENTIAL = "invalid-credential",
61
61
  INVALID_MESSAGE_PAYLOAD = "invalid-message-payload",
62
62
  INVALID_MFA_SESSION = "invalid-multi-factor-session",
63
63
  INVALID_OAUTH_CLIENT_ID = "invalid-oauth-client-id",
@@ -250,6 +250,7 @@ export declare const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
250
250
  readonly INVALID_EMAIL: "auth/invalid-email";
251
251
  readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
252
252
  readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
253
+ readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-credential";
253
254
  readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
254
255
  readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
255
256
  readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";
@@ -16,7 +16,9 @@
16
16
  */
17
17
  import { ActionCodeSettings, Auth, User } from '../../model/public_types';
18
18
  /**
19
- * Gets the list of possible sign in methods for the given email address.
19
+ * Gets the list of possible sign in methods for the given email address. This method returns an
20
+ * empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of
21
+ * authentication methods available for the given email.
20
22
  *
21
23
  * @remarks
22
24
  * This is useful to differentiate methods of sign-in for the same provider, eg.
@@ -27,6 +29,8 @@ import { ActionCodeSettings, Auth, User } from '../../model/public_types';
27
29
  * @param auth - The {@link Auth} instance.
28
30
  * @param email - The user's email address.
29
31
  *
32
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
33
+ * Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).
30
34
  * @public
31
35
  */
32
36
  export declare function fetchSignInMethodsForEmail(auth: Auth, email: string): Promise<string[]>;
@@ -16,7 +16,9 @@
16
16
  */
17
17
  import { ActionCodeInfo, ActionCodeSettings, Auth, UserCredential } from '../../model/public_types';
18
18
  /**
19
- * Sends a password reset email to the given email address.
19
+ * Sends a password reset email to the given email address. This method does not throw an error when
20
+ * there's no user account with the given email address and
21
+ * [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
20
22
  *
21
23
  * @remarks
22
24
  * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
@@ -112,6 +114,8 @@ export declare function createUserWithEmailAndPassword(auth: Auth, email: string
112
114
  *
113
115
  * @remarks
114
116
  * Fails with an error if the email address and password do not match.
117
+ * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
118
+ * this method fails with "auth/invalid-credential" in case of an invalid email/password.
115
119
  *
116
120
  * Note: The user's password is NOT the password used to access the user's email account. The
117
121
  * email address serves as a unique identifier for the user, and the password is used to access
@@ -41,6 +41,9 @@ export declare function updateProfile(user: User, { displayName, photoURL: photo
41
41
  * @param user - The user.
42
42
  * @param newEmail - The new email address.
43
43
  *
44
+ * Throws "auth/operation-not-allowed" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
45
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
46
+ *
44
47
  * @public
45
48
  */
46
49
  export declare function updateEmail(user: User, newEmail: string): Promise<void>;
@@ -174,7 +174,7 @@ function _debugErrorMap() {
174
174
  ["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',
175
175
  ["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',
176
176
  ["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',
177
- ["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',
177
+ ["invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */]: 'The supplied auth credential is incorrect, malformed or has expired.',
178
178
  ["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +
179
179
  'Please fix by going to the Auth email templates section in the Firebase Console.',
180
180
  ["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',
@@ -350,6 +350,7 @@ const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
350
350
  INVALID_EMAIL: 'auth/invalid-email',
351
351
  INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',
352
352
  INVALID_IDP_RESPONSE: 'auth/invalid-credential',
353
+ INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential',
353
354
  INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',
354
355
  INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',
355
356
  INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',
@@ -784,12 +785,15 @@ const SERVER_ERROR_MAP = {
784
785
  ["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */]: "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
785
786
  // This can only happen if the SDK sends a bad request.
786
787
  ["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "missing-password" /* AuthErrorCode.MISSING_PASSWORD */,
788
+ // Thrown if Email Enumeration Protection is enabled in the project and the email or password is
789
+ // invalid.
790
+ ["INVALID_LOGIN_CREDENTIALS" /* ServerError.INVALID_LOGIN_CREDENTIALS */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
787
791
  // Sign up with email and password errors.
788
792
  ["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */]: "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
789
793
  ["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
790
794
  // Verify assertion for sign in with credential errors:
791
- ["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
792
- ["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
795
+ ["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
796
+ ["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
793
797
  ["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
794
798
  // This can only happen if the SDK sends a bad request.
795
799
  ["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
@@ -811,7 +815,7 @@ const SERVER_ERROR_MAP = {
811
815
  // Phone Auth related errors.
812
816
  ["INVALID_CODE" /* ServerError.INVALID_CODE */]: "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
813
817
  ["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */]: "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
814
- ["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
818
+ ["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* AuthErrorCode.INVALID_CREDENTIAL */,
815
819
  ["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */]: "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
816
820
  ["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */]: "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
817
821
  // Other action code errors when additional settings passed.
@@ -5621,7 +5625,9 @@ async function recachePasswordPolicy(auth) {
5621
5625
  }
5622
5626
  }
5623
5627
  /**
5624
- * Sends a password reset email to the given email address.
5628
+ * Sends a password reset email to the given email address. This method does not throw an error when
5629
+ * there's no user account with the given email address and
5630
+ * [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
5625
5631
  *
5626
5632
  * @remarks
5627
5633
  * To complete the password reset, call {@link confirmPasswordReset} with the code supplied in
@@ -5805,6 +5811,8 @@ async function createUserWithEmailAndPassword(auth, email, password) {
5805
5811
  *
5806
5812
  * @remarks
5807
5813
  * Fails with an error if the email address and password do not match.
5814
+ * When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
5815
+ * this method fails with "auth/invalid-credential" in case of an invalid email/password.
5808
5816
  *
5809
5817
  * Note: The user's password is NOT the password used to access the user's email account. The
5810
5818
  * email address serves as a unique identifier for the user, and the password is used to access
@@ -5990,7 +5998,9 @@ async function createAuthUri(auth, request) {
5990
5998
  * limitations under the License.
5991
5999
  */
5992
6000
  /**
5993
- * Gets the list of possible sign in methods for the given email address.
6001
+ * Gets the list of possible sign in methods for the given email address. This method returns an
6002
+ * empty list when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of
6003
+ * authentication methods available for the given email.
5994
6004
  *
5995
6005
  * @remarks
5996
6006
  * This is useful to differentiate methods of sign-in for the same provider, eg.
@@ -6001,6 +6011,8 @@ async function createAuthUri(auth, request) {
6001
6011
  * @param auth - The {@link Auth} instance.
6002
6012
  * @param email - The user's email address.
6003
6013
  *
6014
+ * Deprecated. Migrating off of this method is recommended as a security best-practice.
6015
+ * Learn more in the Identity Platform documentation for [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection).
6004
6016
  * @public
6005
6017
  */
6006
6018
  async function fetchSignInMethodsForEmail(auth, email) {
@@ -6194,6 +6206,9 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
6194
6206
  * @param user - The user.
6195
6207
  * @param newEmail - The new email address.
6196
6208
  *
6209
+ * Throws "auth/operation-not-allowed" error when [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
6210
+ * Deprecated - Use {@link verifyBeforeUpdateEmail} instead.
6211
+ *
6197
6212
  * @public
6198
6213
  */
6199
6214
  function updateEmail(user, newEmail) {
@@ -10265,7 +10280,7 @@ function _isEmptyString(input) {
10265
10280
  }
10266
10281
 
10267
10282
  var name = "@firebase/auth";
10268
- var version = "1.4.0";
10283
+ var version = "1.5.0-20231120214520";
10269
10284
 
10270
10285
  /**
10271
10286
  * @license
@@ -10486,4 +10501,4 @@ function getAuth(app = getApp()) {
10486
10501
  registerAuth("Browser" /* ClientPlatform.BROWSER */);
10487
10502
 
10488
10503
  export { TwitterAuthProvider as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, revokeAccessToken as D, deleteUser as E, FactorId as F, debugErrorMap as G, prodErrorMap as H, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as I, initializeAuth as J, connectAuthEmulator as K, AuthCredential as L, EmailAuthCredential as M, OAuthCredential as N, OperationType as O, PhoneAuthProvider as P, PhoneAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, inMemoryPersistence as U, EmailAuthProvider as V, FacebookAuthProvider as W, GoogleAuthProvider as X, GithubAuthProvider as Y, OAuthProvider as Z, SAMLAuthProvider as _, browserSessionPersistence as a, signInAnonymously as a0, signInWithCredential as a1, linkWithCredential as a2, reauthenticateWithCredential as a3, signInWithCustomToken as a4, sendPasswordResetEmail as a5, confirmPasswordReset as a6, applyActionCode as a7, checkActionCode as a8, verifyPasswordResetCode as a9, _isIOS7Or8 as aA, _createError as aB, _assert as aC, AuthEventManager as aD, _getInstance as aE, _persistenceKeyName as aF, _getRedirectResult as aG, _overrideRedirectResult as aH, _clearRedirectOutcomes as aI, _castAuth as aJ, UserImpl as aK, AuthImpl as aL, _getClientVersion as aM, _generateEventId as aN, AuthPopup as aO, FetchProvider as aP, SAMLAuthCredential as aQ, createUserWithEmailAndPassword as aa, signInWithEmailAndPassword as ab, sendSignInLinkToEmail as ac, isSignInWithEmailLink as ad, signInWithEmailLink as ae, fetchSignInMethodsForEmail as af, sendEmailVerification as ag, verifyBeforeUpdateEmail as ah, ActionCodeURL as ai, parseActionCodeURL as aj, updateProfile as ak, updateEmail as al, updatePassword as am, getIdToken as an, getIdTokenResult as ao, unlink as ap, getAdditionalUserInfo as aq, reload as ar, getMultiFactorResolver as as, multiFactor as at, debugAssert as au, _isIOS as av, _isAndroid as aw, _fail as ax, _getRedirectUrl as ay, _getProjectConfig 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, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
10489
- //# sourceMappingURL=index-61e5ac61.js.map
10504
+ //# sourceMappingURL=index-50a157a9.js.map