@firebase/auth 0.20.11 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cordova/index.js +3 -3
- package/dist/cordova/index.js.map +1 -1
- package/dist/cordova/internal.js +62 -63
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-41041153.js → popup_redirect-b7568081.js} +508 -516
- package/dist/cordova/{popup_redirect-41041153.js.map → popup_redirect-b7568081.js.map} +1 -1
- package/dist/esm2017/{index-0bb4da3b.js → index-c6def6da.js} +477 -484
- package/dist/esm2017/{index-0bb4da3b.js.map → index-c6def6da.js.map} +1 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +15 -15
- package/dist/esm2017/internal.js.map +1 -1
- package/dist/esm5/{index-697aab8a.js → index-ef8e1de2.js} +554 -563
- package/dist/esm5/{index-697aab8a.js.map → index-ef8e1de2.js.map} +1 -1
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +16 -16
- package/dist/esm5/internal.js.map +1 -1
- package/dist/index.webworker.esm5.js +455 -463
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/{index-a6537a51.js → index-2efb81c0.js} +438 -446
- package/dist/node/{index-a6537a51.js.map → index-2efb81c0.js.map} +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal.js +46 -46
- package/dist/node/internal.js.map +1 -1
- package/dist/node-esm/{index-3246d34e.js → index-e0bc98c8.js} +374 -381
- package/dist/node-esm/{index-3246d34e.js.map → index-e0bc98c8.js.map} +1 -1
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +44 -44
- package/dist/node-esm/internal.js.map +1 -1
- package/dist/rn/index.js +3 -3
- package/dist/rn/index.js.map +1 -1
- package/dist/rn/internal.js +97 -98
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/{phone-5340e476.js → phone-bc99e0b0.js} +472 -480
- package/dist/rn/{phone-5340e476.js.map → phone-bc99e0b0.js.map} +1 -1
- package/package.json +8 -8
|
@@ -23,147 +23,147 @@ import { Component } from '@firebase/component';
|
|
|
23
23
|
function _debugErrorMap() {
|
|
24
24
|
var _a;
|
|
25
25
|
return _a = {},
|
|
26
|
-
_a["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
27
|
-
_a["argument-error" /* ARGUMENT_ERROR */] = '',
|
|
28
|
-
_a["app-not-authorized" /* APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
26
|
+
_a["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
27
|
+
_a["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */] = '',
|
|
28
|
+
_a["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
29
29
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
30
30
|
'Review your key configuration in the Google API console.',
|
|
31
|
-
_a["app-not-installed" /* APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
31
|
+
_a["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
32
32
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
33
33
|
'this device.',
|
|
34
|
-
_a["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
34
|
+
_a["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
35
35
|
'already used or the domain associated with it does not match the list ' +
|
|
36
36
|
'of whitelisted domains.',
|
|
37
|
-
_a["code-expired" /* CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
37
|
+
_a["code-expired" /* AuthErrorCode.CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
38
38
|
'again.',
|
|
39
|
-
_a["cordova-not-ready" /* CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
40
|
-
_a["cors-unsupported" /* CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
41
|
-
_a["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
42
|
-
_a["custom-token-mismatch" /* CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
43
|
-
_a["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
39
|
+
_a["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
40
|
+
_a["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
41
|
+
_a["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
42
|
+
_a["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
43
|
+
_a["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
44
44
|
'again before retrying this request.',
|
|
45
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
45
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
46
46
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
47
47
|
'starting any other Firebase SDK.',
|
|
48
|
-
_a["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
48
|
+
_a["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
49
49
|
'conditions.',
|
|
50
|
-
_a["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
51
|
-
_a["email-already-in-use" /* EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
52
|
-
_a["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
50
|
+
_a["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
51
|
+
_a["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
52
|
+
_a["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
53
53
|
'no longer be configured to use the emulator. Try calling ' +
|
|
54
54
|
'"connectAuthEmulator()" sooner.',
|
|
55
|
-
_a["expired-action-code" /* EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
56
|
-
_a["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
57
|
-
_a["internal-error" /* INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
58
|
-
_a["invalid-app-credential" /* INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
55
|
+
_a["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
56
|
+
_a["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
57
|
+
_a["internal-error" /* AuthErrorCode.INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
58
|
+
_a["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
59
59
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
60
|
-
_a["invalid-app-id" /* INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
61
|
-
_a["invalid-user-token" /* INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
60
|
+
_a["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
61
|
+
_a["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
62
62
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
63
63
|
'the project associated with this API key.',
|
|
64
|
-
_a["invalid-auth-event" /* INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
65
|
-
_a["invalid-verification-code" /* INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
64
|
+
_a["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
65
|
+
_a["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
66
66
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
67
67
|
'verification code provided by the user.',
|
|
68
|
-
_a["invalid-continue-uri" /* INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
69
|
-
_a["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
68
|
+
_a["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
69
|
+
_a["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
70
70
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
71
71
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
72
72
|
'cordova-plugin-customurlscheme.',
|
|
73
|
-
_a["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
74
|
-
_a["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
75
|
-
_a["invalid-email" /* INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
76
|
-
_a["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
77
|
-
_a["invalid-api-key" /* INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
78
|
-
_a["invalid-cert-hash" /* INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
79
|
-
_a["invalid-credential" /* INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
80
|
-
_a["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
73
|
+
_a["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
74
|
+
_a["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
75
|
+
_a["invalid-email" /* AuthErrorCode.INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
76
|
+
_a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
77
|
+
_a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
78
|
+
_a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
79
|
+
_a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
80
|
+
_a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
81
81
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
82
|
-
_a["invalid-multi-factor-session" /* INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
83
|
-
_a["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
82
|
+
_a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
83
|
+
_a["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
84
84
|
'only supports OAuth providers.',
|
|
85
|
-
_a["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
85
|
+
_a["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
86
86
|
'specified API key.',
|
|
87
|
-
_a["unauthorized-domain" /* INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
87
|
+
_a["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
88
88
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
89
|
-
_a["invalid-action-code" /* INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
89
|
+
_a["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
90
90
|
'expired, or has already been used.',
|
|
91
|
-
_a["wrong-password" /* INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
92
|
-
_a["invalid-persistence-type" /* INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
93
|
-
_a["invalid-phone-number" /* INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
91
|
+
_a["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
92
|
+
_a["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
93
|
+
_a["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
94
94
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
95
95
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
96
96
|
'number including area code].',
|
|
97
|
-
_a["invalid-provider-id" /* INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
98
|
-
_a["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
97
|
+
_a["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
98
|
+
_a["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
99
99
|
'recipient email address is invalid.',
|
|
100
|
-
_a["invalid-sender" /* INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
100
|
+
_a["invalid-sender" /* AuthErrorCode.INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
101
101
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
102
|
-
_a["invalid-verification-id" /* INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
103
|
-
_a["invalid-tenant-id" /* INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
104
|
-
_a["login-blocked" /* LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
105
|
-
_a["missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
106
|
-
_a["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
102
|
+
_a["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
103
|
+
_a["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
104
|
+
_a["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
105
|
+
_a["missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
106
|
+
_a["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
107
107
|
'by following the instructions in the Firebase console.',
|
|
108
|
-
_a["missing-app-credential" /* MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
108
|
+
_a["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
109
109
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
110
|
-
_a["missing-verification-code" /* MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
111
|
-
_a["missing-continue-uri" /* MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
112
|
-
_a["missing-iframe-start" /* MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
113
|
-
_a["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
114
|
-
_a["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
110
|
+
_a["missing-verification-code" /* AuthErrorCode.MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
111
|
+
_a["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
112
|
+
_a["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
113
|
+
_a["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
114
|
+
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
115
115
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
116
116
|
'in the ID token payload.',
|
|
117
|
-
_a["missing-multi-factor-info" /* MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
118
|
-
_a["missing-multi-factor-session" /* MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
119
|
-
_a["missing-phone-number" /* MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
120
|
-
_a["missing-verification-id" /* MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
121
|
-
_a["app-deleted" /* MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
122
|
-
_a["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
123
|
-
_a["multi-factor-auth-required" /* MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
124
|
-
_a["account-exists-with-different-credential" /* NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
117
|
+
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
118
|
+
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
119
|
+
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
120
|
+
_a["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
121
|
+
_a["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
122
|
+
_a["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
123
|
+
_a["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
124
|
+
_a["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
125
125
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
126
126
|
'email address.',
|
|
127
|
-
_a["network-request-failed" /* NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
128
|
-
_a["no-auth-event" /* NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
129
|
-
_a["no-such-provider" /* NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
130
|
-
_a["null-user" /* NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
127
|
+
_a["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
128
|
+
_a["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
129
|
+
_a["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
130
|
+
_a["null-user" /* AuthErrorCode.NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
131
131
|
'requires a non-null user object.',
|
|
132
|
-
_a["operation-not-allowed" /* OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
132
|
+
_a["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
133
133
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
134
134
|
'Auth section.',
|
|
135
|
-
_a["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
135
|
+
_a["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
136
136
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
137
137
|
' and web storage must be enabled.',
|
|
138
|
-
_a["popup-blocked" /* POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
139
|
-
_a["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
140
|
-
_a["provider-already-linked" /* PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
141
|
-
_a["quota-exceeded" /* QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
142
|
-
_a["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
143
|
-
_a["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
144
|
-
_a["rejected-credential" /* REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
145
|
-
_a["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
146
|
-
_a["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
147
|
-
_a["tenant-id-mismatch" /* TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
148
|
-
_a["timeout" /* TIMEOUT */] = 'The operation has timed out.',
|
|
149
|
-
_a["user-token-expired" /* TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
150
|
-
_a["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
138
|
+
_a["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
139
|
+
_a["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
140
|
+
_a["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
141
|
+
_a["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
142
|
+
_a["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
143
|
+
_a["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
144
|
+
_a["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
145
|
+
_a["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
146
|
+
_a["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
147
|
+
_a["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
148
|
+
_a["timeout" /* AuthErrorCode.TIMEOUT */] = 'The operation has timed out.',
|
|
149
|
+
_a["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
150
|
+
_a["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
151
151
|
'Try again later.',
|
|
152
|
-
_a["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
152
|
+
_a["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
153
153
|
'the domain in the Firebase console.',
|
|
154
|
-
_a["unsupported-first-factor" /* UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
155
|
-
_a["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
156
|
-
_a["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
157
|
-
_a["unverified-email" /* UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
158
|
-
_a["user-cancelled" /* USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
159
|
-
_a["user-not-found" /* USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
154
|
+
_a["unsupported-first-factor" /* AuthErrorCode.UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
155
|
+
_a["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
156
|
+
_a["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
157
|
+
_a["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
158
|
+
_a["user-cancelled" /* AuthErrorCode.USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
159
|
+
_a["user-not-found" /* AuthErrorCode.USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
160
160
|
'have been deleted.',
|
|
161
|
-
_a["user-disabled" /* USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
162
|
-
_a["user-mismatch" /* USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
163
|
-
_a["user-signed-out" /* USER_SIGNED_OUT */] = '',
|
|
164
|
-
_a["weak-password" /* WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
165
|
-
_a["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
166
|
-
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
161
|
+
_a["user-disabled" /* AuthErrorCode.USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
162
|
+
_a["user-mismatch" /* AuthErrorCode.USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
163
|
+
_a["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */] = '',
|
|
164
|
+
_a["weak-password" /* AuthErrorCode.WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
165
|
+
_a["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
166
|
+
_a["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
167
167
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
168
168
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
169
169
|
' already initialized instance.',
|
|
@@ -175,7 +175,7 @@ function _prodErrorMap() {
|
|
|
175
175
|
// nature of this error, developers will never be able to see the message
|
|
176
176
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
177
177
|
return _a = {},
|
|
178
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
178
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
179
179
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
180
180
|
'starting any other Firebase SDK.',
|
|
181
181
|
_a;
|
|
@@ -329,7 +329,7 @@ function _logError(msg) {
|
|
|
329
329
|
args[_i - 1] = arguments[_i];
|
|
330
330
|
}
|
|
331
331
|
if (logClient.logLevel <= LogLevel.ERROR) {
|
|
332
|
-
logClient.error.apply(logClient, __spreadArray(["Auth ("
|
|
332
|
+
logClient.error.apply(logClient, __spreadArray(["Auth (".concat(SDK_VERSION, "): ").concat(msg)], args, false));
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -354,14 +354,14 @@ function _fail(authOrCode) {
|
|
|
354
354
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
355
355
|
rest[_i - 1] = arguments[_i];
|
|
356
356
|
}
|
|
357
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
357
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
358
358
|
}
|
|
359
359
|
function _createError(authOrCode) {
|
|
360
360
|
var rest = [];
|
|
361
361
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
362
362
|
rest[_i - 1] = arguments[_i];
|
|
363
363
|
}
|
|
364
|
-
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
364
|
+
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
365
365
|
}
|
|
366
366
|
function _errorWithCustomMessage(auth, code, message) {
|
|
367
367
|
var _a;
|
|
@@ -379,13 +379,13 @@ function createErrorInternal(authOrCode) {
|
|
|
379
379
|
}
|
|
380
380
|
if (typeof authOrCode !== 'string') {
|
|
381
381
|
var code = rest[0];
|
|
382
|
-
var fullParams = __spreadArray([], rest.slice(1));
|
|
382
|
+
var fullParams = __spreadArray([], rest.slice(1), true);
|
|
383
383
|
if (fullParams[0]) {
|
|
384
384
|
fullParams[0].appName = authOrCode.name;
|
|
385
385
|
}
|
|
386
|
-
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams));
|
|
386
|
+
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams, false));
|
|
387
387
|
}
|
|
388
|
-
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest));
|
|
388
|
+
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest, false));
|
|
389
389
|
}
|
|
390
390
|
function _assert(assertion, authOrCode) {
|
|
391
391
|
var rest = [];
|
|
@@ -393,7 +393,7 @@ function _assert(assertion, authOrCode) {
|
|
|
393
393
|
rest[_i - 2] = arguments[_i];
|
|
394
394
|
}
|
|
395
395
|
if (!assertion) {
|
|
396
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
396
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
/**
|
|
@@ -504,7 +504,7 @@ function initializeAuth(app, deps) {
|
|
|
504
504
|
return auth_1;
|
|
505
505
|
}
|
|
506
506
|
else {
|
|
507
|
-
_fail(auth_1, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
507
|
+
_fail(auth_1, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
var auth = provider.initialize({ options: deps });
|
|
@@ -523,7 +523,7 @@ function _initializeAuthInstance(auth, deps) {
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
var name = "@firebase/auth";
|
|
526
|
-
var version = "0.
|
|
526
|
+
var version = "0.21.0";
|
|
527
527
|
|
|
528
528
|
/**
|
|
529
529
|
* @license
|
|
@@ -547,42 +547,42 @@ var version = "0.20.11";
|
|
|
547
547
|
function _getBrowserName(userAgent) {
|
|
548
548
|
var ua = userAgent.toLowerCase();
|
|
549
549
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
550
|
-
return "Opera" /* OPERA */;
|
|
550
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
551
551
|
}
|
|
552
552
|
else if (_isIEMobile(ua)) {
|
|
553
553
|
// Windows phone IEMobile browser.
|
|
554
|
-
return "IEMobile" /* IEMOBILE */;
|
|
554
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
555
555
|
}
|
|
556
556
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
557
|
-
return "IE" /* IE */;
|
|
557
|
+
return "IE" /* BrowserName.IE */;
|
|
558
558
|
}
|
|
559
559
|
else if (ua.includes('edge/')) {
|
|
560
|
-
return "Edge" /* EDGE */;
|
|
560
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
561
561
|
}
|
|
562
562
|
else if (_isFirefox(ua)) {
|
|
563
|
-
return "Firefox" /* FIREFOX */;
|
|
563
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
564
564
|
}
|
|
565
565
|
else if (ua.includes('silk/')) {
|
|
566
|
-
return "Silk" /* SILK */;
|
|
566
|
+
return "Silk" /* BrowserName.SILK */;
|
|
567
567
|
}
|
|
568
568
|
else if (_isBlackBerry(ua)) {
|
|
569
569
|
// Blackberry browser.
|
|
570
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
570
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
571
571
|
}
|
|
572
572
|
else if (_isWebOS(ua)) {
|
|
573
573
|
// WebOS default browser.
|
|
574
|
-
return "Webos" /* WEBOS */;
|
|
574
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
575
575
|
}
|
|
576
576
|
else if (_isSafari(ua)) {
|
|
577
|
-
return "Safari" /* SAFARI */;
|
|
577
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
578
578
|
}
|
|
579
579
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
580
580
|
!ua.includes('edge/')) {
|
|
581
|
-
return "Chrome" /* CHROME */;
|
|
581
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
582
582
|
}
|
|
583
583
|
else if (_isAndroid(ua)) {
|
|
584
584
|
// Android stock browser.
|
|
585
|
-
return "Android" /* ANDROID */;
|
|
585
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
586
586
|
}
|
|
587
587
|
else {
|
|
588
588
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -592,7 +592,7 @@ function _getBrowserName(userAgent) {
|
|
|
592
592
|
return matches[1];
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
return "Other" /* OTHER */;
|
|
595
|
+
return "Other" /* BrowserName.OTHER */;
|
|
596
596
|
}
|
|
597
597
|
function _isFirefox(ua) {
|
|
598
598
|
if (ua === void 0) { ua = getUA(); }
|
|
@@ -650,15 +650,15 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
650
650
|
if (frameworks === void 0) { frameworks = []; }
|
|
651
651
|
var reportedPlatform;
|
|
652
652
|
switch (clientPlatform) {
|
|
653
|
-
case "Browser" /* BROWSER */:
|
|
653
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
654
654
|
// In a browser environment, report the browser name.
|
|
655
655
|
reportedPlatform = _getBrowserName(getUA());
|
|
656
656
|
break;
|
|
657
|
-
case "Worker" /* WORKER */:
|
|
657
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
658
658
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
659
659
|
// worker from a browser.
|
|
660
660
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
661
|
-
reportedPlatform = _getBrowserName(getUA())
|
|
661
|
+
reportedPlatform = "".concat(_getBrowserName(getUA()), "-").concat(clientPlatform);
|
|
662
662
|
break;
|
|
663
663
|
default:
|
|
664
664
|
reportedPlatform = clientPlatform;
|
|
@@ -666,7 +666,7 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
666
666
|
var reportedFrameworks = frameworks.length
|
|
667
667
|
? frameworks.join(',')
|
|
668
668
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
669
|
-
return reportedPlatform
|
|
669
|
+
return "".concat(reportedPlatform, "/").concat("JsCore" /* ClientImplementation.CORE */, "/").concat(SDK_VERSION, "/").concat(reportedFrameworks);
|
|
670
670
|
}
|
|
671
671
|
|
|
672
672
|
/**
|
|
@@ -779,7 +779,7 @@ var Delay = /** @class */ (function () {
|
|
|
779
779
|
Delay.prototype.get = function () {
|
|
780
780
|
if (!_isOnline()) {
|
|
781
781
|
// Pick the shorter timeout.
|
|
782
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
782
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
783
783
|
}
|
|
784
784
|
// If running in a mobile environment, return the long delay, otherwise
|
|
785
785
|
// return the short delay.
|
|
@@ -812,7 +812,7 @@ function _emulatorUrl(config, path) {
|
|
|
812
812
|
if (!path) {
|
|
813
813
|
return url;
|
|
814
814
|
}
|
|
815
|
-
return ""
|
|
815
|
+
return "".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);
|
|
816
816
|
}
|
|
817
817
|
|
|
818
818
|
/**
|
|
@@ -895,64 +895,64 @@ var _a$1;
|
|
|
895
895
|
*/
|
|
896
896
|
var SERVER_ERROR_MAP = (_a$1 = {},
|
|
897
897
|
// Custom token errors.
|
|
898
|
-
_a$1["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
898
|
+
_a$1["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
899
899
|
// This can only happen if the SDK sends a bad request.
|
|
900
|
-
_a$1["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */] = "internal-error" /* INTERNAL_ERROR */,
|
|
900
|
+
_a$1["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
901
901
|
// Create Auth URI errors.
|
|
902
|
-
_a$1["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */] = "invalid-email" /* INVALID_EMAIL */,
|
|
902
|
+
_a$1["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */] = "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
903
903
|
// This can only happen if the SDK sends a bad request.
|
|
904
|
-
_a$1["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */] = "internal-error" /* INTERNAL_ERROR */,
|
|
904
|
+
_a$1["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
905
905
|
// Sign in with email and password errors (some apply to sign up too).
|
|
906
|
-
_a$1["INVALID_PASSWORD" /* INVALID_PASSWORD */] = "wrong-password" /* INVALID_PASSWORD */,
|
|
906
|
+
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
907
907
|
// This can only happen if the SDK sends a bad request.
|
|
908
|
-
_a$1["MISSING_PASSWORD" /* MISSING_PASSWORD */] = "internal-error" /* INTERNAL_ERROR */,
|
|
908
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
909
909
|
// Sign up with email and password errors.
|
|
910
|
-
_a$1["EMAIL_EXISTS" /* EMAIL_EXISTS */] = "email-already-in-use" /* EMAIL_EXISTS */,
|
|
911
|
-
_a$1["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
910
|
+
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
911
|
+
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
912
912
|
// Verify assertion for sign in with credential errors:
|
|
913
|
-
_a$1["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
914
|
-
_a$1["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
915
|
-
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
913
|
+
_a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
914
|
+
_a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
915
|
+
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
916
916
|
// This can only happen if the SDK sends a bad request.
|
|
917
|
-
_a$1["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
917
|
+
_a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
918
918
|
// Send Password reset email errors:
|
|
919
|
-
_a$1["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
920
|
-
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
921
|
-
_a$1["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */] = "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
922
|
-
_a$1["INVALID_OOB_CODE" /* INVALID_OOB_CODE */] = "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
919
|
+
_a$1["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
920
|
+
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
921
|
+
_a$1["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */] = "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
922
|
+
_a$1["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */] = "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
923
923
|
// This can only happen if the SDK sends a bad request.
|
|
924
|
-
_a$1["MISSING_OOB_CODE" /* MISSING_OOB_CODE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
924
|
+
_a$1["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
925
925
|
// Operations that require ID token in request:
|
|
926
|
-
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
927
|
-
_a$1["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */] = "invalid-user-token" /* INVALID_AUTH */,
|
|
928
|
-
_a$1["TOKEN_EXPIRED" /* TOKEN_EXPIRED */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
929
|
-
_a$1["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
926
|
+
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
927
|
+
_a$1["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */] = "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
928
|
+
_a$1["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
929
|
+
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
930
930
|
// Other errors.
|
|
931
|
-
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
931
|
+
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
932
932
|
// Phone Auth related errors.
|
|
933
|
-
_a$1["INVALID_CODE" /* INVALID_CODE */] = "invalid-verification-code" /* INVALID_CODE */,
|
|
934
|
-
_a$1["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */] = "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
935
|
-
_a$1["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
936
|
-
_a$1["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */] = "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
937
|
-
_a$1["SESSION_EXPIRED" /* SESSION_EXPIRED */] = "code-expired" /* CODE_EXPIRED */,
|
|
933
|
+
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
934
|
+
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
935
|
+
_a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
936
|
+
_a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
937
|
+
_a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
938
938
|
// Other action code errors when additional settings passed.
|
|
939
939
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
940
940
|
// This is OK as this error will be caught by client side validation.
|
|
941
|
-
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
942
|
-
_a$1["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
941
|
+
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
942
|
+
_a$1["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
943
943
|
// getProjectConfig errors when clientId is passed.
|
|
944
|
-
_a$1["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
944
|
+
_a$1["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
945
945
|
// User actions (sign-up or deletion) disabled errors.
|
|
946
|
-
_a$1["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
946
|
+
_a$1["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
947
947
|
// Multi factor related errors.
|
|
948
|
-
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
949
|
-
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
950
|
-
_a$1["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
951
|
-
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
952
|
-
_a$1["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
953
|
-
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
948
|
+
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
949
|
+
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
950
|
+
_a$1["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
951
|
+
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
952
|
+
_a$1["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
953
|
+
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
954
954
|
// Blocking functions related errors.
|
|
955
|
-
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
955
|
+
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
956
956
|
_a$1);
|
|
957
957
|
|
|
958
958
|
/**
|
|
@@ -991,7 +991,7 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
991
991
|
body = {};
|
|
992
992
|
params = {};
|
|
993
993
|
if (request) {
|
|
994
|
-
if (method === "GET" /* GET */) {
|
|
994
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
995
995
|
params = request;
|
|
996
996
|
}
|
|
997
997
|
else {
|
|
@@ -1004,12 +1004,11 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
1004
1004
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1005
1005
|
case 1:
|
|
1006
1006
|
headers = _a.sent();
|
|
1007
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
1007
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
1008
1008
|
if (auth.languageCode) {
|
|
1009
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
1009
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
1010
1010
|
}
|
|
1011
|
-
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method,
|
|
1012
|
-
headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
1011
|
+
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method, headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
1013
1012
|
}
|
|
1014
1013
|
});
|
|
1015
1014
|
}); })];
|
|
@@ -1041,7 +1040,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1041
1040
|
case 3:
|
|
1042
1041
|
json = _b.sent();
|
|
1043
1042
|
if ('needConfirmation' in json) {
|
|
1044
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
1043
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
1045
1044
|
}
|
|
1046
1045
|
if (response.ok && !('errorMessage' in json)) {
|
|
1047
1046
|
return [2 /*return*/, json];
|
|
@@ -1049,14 +1048,14 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1049
1048
|
else {
|
|
1050
1049
|
errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
1051
1050
|
_a = errorMessage.split(' : '), serverErrorCode = _a[0], serverErrorMessage = _a[1];
|
|
1052
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1053
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1051
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1052
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1054
1053
|
}
|
|
1055
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
1056
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
1054
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
1055
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
1057
1056
|
}
|
|
1058
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
1059
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
1057
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
1058
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
1060
1059
|
}
|
|
1061
1060
|
authError = errorMap[serverErrorCode] ||
|
|
1062
1061
|
serverErrorCode
|
|
@@ -1075,7 +1074,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1075
1074
|
if (e_1 instanceof FirebaseError) {
|
|
1076
1075
|
throw e_1;
|
|
1077
1076
|
}
|
|
1078
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
1077
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
1079
1078
|
return [3 /*break*/, 5];
|
|
1080
1079
|
case 5: return [2 /*return*/];
|
|
1081
1080
|
}
|
|
@@ -1092,7 +1091,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1092
1091
|
case 1:
|
|
1093
1092
|
serverResponse = (_a.sent());
|
|
1094
1093
|
if ('mfaPendingCredential' in serverResponse) {
|
|
1095
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
1094
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
1096
1095
|
_serverResponse: serverResponse
|
|
1097
1096
|
});
|
|
1098
1097
|
}
|
|
@@ -1102,9 +1101,9 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1102
1101
|
});
|
|
1103
1102
|
}
|
|
1104
1103
|
function _getFinalTarget(auth, host, path, query) {
|
|
1105
|
-
var base = ""
|
|
1104
|
+
var base = "".concat(host).concat(path, "?").concat(query);
|
|
1106
1105
|
if (!auth.config.emulator) {
|
|
1107
|
-
return auth.config.apiScheme
|
|
1106
|
+
return "".concat(auth.config.apiScheme, "://").concat(base);
|
|
1108
1107
|
}
|
|
1109
1108
|
return _emulatorUrl(auth.config, base);
|
|
1110
1109
|
}
|
|
@@ -1118,7 +1117,7 @@ var NetworkTimeout = /** @class */ (function () {
|
|
|
1118
1117
|
this.timer = null;
|
|
1119
1118
|
this.promise = new Promise(function (_, reject) {
|
|
1120
1119
|
_this.timer = setTimeout(function () {
|
|
1121
|
-
return reject(_createError(_this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1120
|
+
return reject(_createError(_this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1122
1121
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1123
1122
|
});
|
|
1124
1123
|
}
|
|
@@ -1162,21 +1161,21 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1162
1161
|
function deleteAccount(auth, request) {
|
|
1163
1162
|
return __awaiter(this, void 0, void 0, function () {
|
|
1164
1163
|
return __generator(this, function (_a) {
|
|
1165
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request)];
|
|
1164
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request)];
|
|
1166
1165
|
});
|
|
1167
1166
|
});
|
|
1168
1167
|
}
|
|
1169
1168
|
function deleteLinkedAccounts(auth, request) {
|
|
1170
1169
|
return __awaiter(this, void 0, void 0, function () {
|
|
1171
1170
|
return __generator(this, function (_a) {
|
|
1172
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
1171
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
1173
1172
|
});
|
|
1174
1173
|
});
|
|
1175
1174
|
}
|
|
1176
1175
|
function getAccountInfo(auth, request) {
|
|
1177
1176
|
return __awaiter(this, void 0, void 0, function () {
|
|
1178
1177
|
return __generator(this, function (_a) {
|
|
1179
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request)];
|
|
1178
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request)];
|
|
1180
1179
|
});
|
|
1181
1180
|
});
|
|
1182
1181
|
}
|
|
@@ -1272,7 +1271,7 @@ function getIdTokenResult(user, forceRefresh) {
|
|
|
1272
1271
|
case 1:
|
|
1273
1272
|
token = _a.sent();
|
|
1274
1273
|
claims = _parseToken(token);
|
|
1275
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1274
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1276
1275
|
firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1277
1276
|
signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1278
1277
|
return [2 /*return*/, {
|
|
@@ -1292,8 +1291,7 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1292
1291
|
return Number(seconds) * 1000;
|
|
1293
1292
|
}
|
|
1294
1293
|
function _parseToken(token) {
|
|
1295
|
-
var _a;
|
|
1296
|
-
var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
|
|
1294
|
+
var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
|
|
1297
1295
|
if (algorithm === undefined ||
|
|
1298
1296
|
payload === undefined ||
|
|
1299
1297
|
signature === undefined) {
|
|
@@ -1309,7 +1307,7 @@ function _parseToken(token) {
|
|
|
1309
1307
|
return JSON.parse(decoded);
|
|
1310
1308
|
}
|
|
1311
1309
|
catch (e) {
|
|
1312
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1310
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1313
1311
|
return null;
|
|
1314
1312
|
}
|
|
1315
1313
|
}
|
|
@@ -1318,9 +1316,9 @@ function _parseToken(token) {
|
|
|
1318
1316
|
*/
|
|
1319
1317
|
function _tokenExpiresIn(token) {
|
|
1320
1318
|
var parsedToken = _parseToken(token);
|
|
1321
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1322
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1323
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1319
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1320
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1321
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1324
1322
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1325
1323
|
}
|
|
1326
1324
|
|
|
@@ -1371,8 +1369,8 @@ function _logoutIfInvalidated(user, promise, bypassAuthState) {
|
|
|
1371
1369
|
}
|
|
1372
1370
|
function isUserInvalidated(_a) {
|
|
1373
1371
|
var code = _a.code;
|
|
1374
|
-
return (code === "auth/"
|
|
1375
|
-
code === "auth/"
|
|
1372
|
+
return (code === "auth/".concat("user-disabled" /* AuthErrorCode.USER_DISABLED */) ||
|
|
1373
|
+
code === "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */));
|
|
1376
1374
|
}
|
|
1377
1375
|
|
|
1378
1376
|
/**
|
|
@@ -1400,7 +1398,7 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1400
1398
|
// we can't cast properly in both environments.
|
|
1401
1399
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1402
1400
|
this.timerId = null;
|
|
1403
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1401
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1404
1402
|
}
|
|
1405
1403
|
ProactiveRefresh.prototype._start = function () {
|
|
1406
1404
|
if (this.isRunning) {
|
|
@@ -1422,14 +1420,14 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1422
1420
|
var _a;
|
|
1423
1421
|
if (wasError) {
|
|
1424
1422
|
var interval = this.errorBackoff;
|
|
1425
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1423
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1426
1424
|
return interval;
|
|
1427
1425
|
}
|
|
1428
1426
|
else {
|
|
1429
1427
|
// Reset the error backoff
|
|
1430
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1428
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1431
1429
|
var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1432
|
-
var interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1430
|
+
var interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1433
1431
|
return Math.max(0, interval);
|
|
1434
1432
|
}
|
|
1435
1433
|
};
|
|
@@ -1453,22 +1451,21 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1453
1451
|
}); }, interval);
|
|
1454
1452
|
};
|
|
1455
1453
|
ProactiveRefresh.prototype.iteration = function () {
|
|
1456
|
-
var _a;
|
|
1457
1454
|
return __awaiter(this, void 0, void 0, function () {
|
|
1458
1455
|
var e_1;
|
|
1459
|
-
return __generator(this, function (
|
|
1460
|
-
switch (
|
|
1456
|
+
return __generator(this, function (_a) {
|
|
1457
|
+
switch (_a.label) {
|
|
1461
1458
|
case 0:
|
|
1462
|
-
|
|
1459
|
+
_a.trys.push([0, 2, , 3]);
|
|
1463
1460
|
return [4 /*yield*/, this.user.getIdToken(true)];
|
|
1464
1461
|
case 1:
|
|
1465
|
-
|
|
1462
|
+
_a.sent();
|
|
1466
1463
|
return [3 /*break*/, 3];
|
|
1467
1464
|
case 2:
|
|
1468
|
-
e_1 =
|
|
1465
|
+
e_1 = _a.sent();
|
|
1469
1466
|
// Only retry on network errors
|
|
1470
|
-
if ((
|
|
1471
|
-
"auth/"
|
|
1467
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) ===
|
|
1468
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
1472
1469
|
this.schedule(/* wasError */ true);
|
|
1473
1470
|
}
|
|
1474
1471
|
return [2 /*return*/];
|
|
@@ -1552,7 +1549,7 @@ function _reloadWithoutSaving(user) {
|
|
|
1552
1549
|
return [4 /*yield*/, _logoutIfInvalidated(user, getAccountInfo(auth, { idToken: idToken }))];
|
|
1553
1550
|
case 2:
|
|
1554
1551
|
response = _b.sent();
|
|
1555
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1552
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1556
1553
|
coreAccount = response.users[0];
|
|
1557
1554
|
user._notifyReloadListener(coreAccount);
|
|
1558
1555
|
newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1614,7 +1611,7 @@ function reload(user) {
|
|
|
1614
1611
|
}
|
|
1615
1612
|
function mergeProviderData(original, newData) {
|
|
1616
1613
|
var deduped = original.filter(function (o) { return !newData.some(function (n) { return n.providerId === o.providerId; }); });
|
|
1617
|
-
return __spreadArray(__spreadArray([], deduped), newData);
|
|
1614
|
+
return __spreadArray(__spreadArray([], deduped, true), newData, true);
|
|
1618
1615
|
}
|
|
1619
1616
|
function extractProviderData(providers) {
|
|
1620
1617
|
return providers.map(function (_a) {
|
|
@@ -1662,13 +1659,13 @@ function requestStsToken(auth, refreshToken) {
|
|
|
1662
1659
|
'refresh_token': refreshToken
|
|
1663
1660
|
}).slice(1);
|
|
1664
1661
|
_a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
|
|
1665
|
-
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key="
|
|
1662
|
+
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, "key=".concat(apiKey));
|
|
1666
1663
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1667
1664
|
case 1:
|
|
1668
1665
|
headers = _b.sent();
|
|
1669
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1666
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1670
1667
|
return [2 /*return*/, FetchProvider.fetch()(url, {
|
|
1671
|
-
method: "POST" /* POST */,
|
|
1668
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1672
1669
|
headers: headers,
|
|
1673
1670
|
body: body
|
|
1674
1671
|
})];
|
|
@@ -1719,15 +1716,15 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1719
1716
|
Object.defineProperty(StsTokenManager.prototype, "isExpired", {
|
|
1720
1717
|
get: function () {
|
|
1721
1718
|
return (!this.expirationTime ||
|
|
1722
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1719
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1723
1720
|
},
|
|
1724
1721
|
enumerable: false,
|
|
1725
1722
|
configurable: true
|
|
1726
1723
|
});
|
|
1727
1724
|
StsTokenManager.prototype.updateFromServerResponse = function (response) {
|
|
1728
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1729
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1730
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1725
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1726
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1727
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1731
1728
|
var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1732
1729
|
? Number(response.expiresIn)
|
|
1733
1730
|
: _tokenExpiresIn(response.idToken);
|
|
@@ -1739,7 +1736,7 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1739
1736
|
return __generator(this, function (_a) {
|
|
1740
1737
|
switch (_a.label) {
|
|
1741
1738
|
case 0:
|
|
1742
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1739
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1743
1740
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1744
1741
|
return [2 /*return*/, this.accessToken];
|
|
1745
1742
|
}
|
|
@@ -1779,19 +1776,19 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1779
1776
|
var refreshToken = object.refreshToken, accessToken = object.accessToken, expirationTime = object.expirationTime;
|
|
1780
1777
|
var manager = new StsTokenManager();
|
|
1781
1778
|
if (refreshToken) {
|
|
1782
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1779
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1783
1780
|
appName: appName
|
|
1784
1781
|
});
|
|
1785
1782
|
manager.refreshToken = refreshToken;
|
|
1786
1783
|
}
|
|
1787
1784
|
if (accessToken) {
|
|
1788
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1785
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1789
1786
|
appName: appName
|
|
1790
1787
|
});
|
|
1791
1788
|
manager.accessToken = accessToken;
|
|
1792
1789
|
}
|
|
1793
1790
|
if (expirationTime) {
|
|
1794
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1791
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1795
1792
|
appName: appName
|
|
1796
1793
|
});
|
|
1797
1794
|
manager.expirationTime = expirationTime;
|
|
@@ -1836,13 +1833,13 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1836
1833
|
* limitations under the License.
|
|
1837
1834
|
*/
|
|
1838
1835
|
function assertStringOrUndefined(assertion, appName) {
|
|
1839
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName: appName });
|
|
1836
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName: appName });
|
|
1840
1837
|
}
|
|
1841
1838
|
var UserImpl = /** @class */ (function () {
|
|
1842
1839
|
function UserImpl(_a) {
|
|
1843
1840
|
var uid = _a.uid, auth = _a.auth, stsTokenManager = _a.stsTokenManager, opt = __rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1844
1841
|
// For the user object, provider is always Firebase.
|
|
1845
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1842
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1846
1843
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1847
1844
|
this.reloadUserInfo = null;
|
|
1848
1845
|
this.reloadListener = null;
|
|
@@ -1857,7 +1854,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1857
1854
|
this.photoURL = opt.photoURL || null;
|
|
1858
1855
|
this.isAnonymous = opt.isAnonymous || false;
|
|
1859
1856
|
this.tenantId = opt.tenantId || null;
|
|
1860
|
-
this.providerData = opt.providerData ? __spreadArray([], opt.providerData) : [];
|
|
1857
|
+
this.providerData = opt.providerData ? __spreadArray([], opt.providerData, true) : [];
|
|
1861
1858
|
this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);
|
|
1862
1859
|
}
|
|
1863
1860
|
UserImpl.prototype.getIdToken = function (forceRefresh) {
|
|
@@ -1868,7 +1865,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1868
1865
|
case 0: return [4 /*yield*/, _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh))];
|
|
1869
1866
|
case 1:
|
|
1870
1867
|
accessToken = _a.sent();
|
|
1871
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1868
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1872
1869
|
if (!(this.accessToken !== accessToken)) return [3 /*break*/, 3];
|
|
1873
1870
|
this.accessToken = accessToken;
|
|
1874
1871
|
return [4 /*yield*/, this.auth._persistUserIfCurrent(this)];
|
|
@@ -1891,7 +1888,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1891
1888
|
if (this === user) {
|
|
1892
1889
|
return;
|
|
1893
1890
|
}
|
|
1894
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1891
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1895
1892
|
this.displayName = user.displayName;
|
|
1896
1893
|
this.photoURL = user.photoURL;
|
|
1897
1894
|
this.email = user.email;
|
|
@@ -1908,7 +1905,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1908
1905
|
};
|
|
1909
1906
|
UserImpl.prototype._onReload = function (callback) {
|
|
1910
1907
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1911
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1908
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1912
1909
|
this.reloadListener = callback;
|
|
1913
1910
|
if (this.reloadUserInfo) {
|
|
1914
1911
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -2004,13 +2001,13 @@ var UserImpl = /** @class */ (function () {
|
|
|
2004
2001
|
var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
2005
2002
|
var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
2006
2003
|
var uid = object.uid, emailVerified = object.emailVerified, isAnonymous = object.isAnonymous, providerData = object.providerData, plainObjectTokenManager = object.stsTokenManager;
|
|
2007
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2004
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2008
2005
|
var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
2009
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2006
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2010
2007
|
assertStringOrUndefined(displayName, auth.name);
|
|
2011
2008
|
assertStringOrUndefined(email, auth.name);
|
|
2012
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2013
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2009
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2010
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2014
2011
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
2015
2012
|
assertStringOrUndefined(photoURL, auth.name);
|
|
2016
2013
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -2090,7 +2087,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2090
2087
|
*/
|
|
2091
2088
|
var InMemoryPersistence = /** @class */ (function () {
|
|
2092
2089
|
function InMemoryPersistence() {
|
|
2093
|
-
this.type = "NONE" /* NONE */;
|
|
2090
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
2094
2091
|
this.storage = {};
|
|
2095
2092
|
}
|
|
2096
2093
|
InMemoryPersistence.prototype._isAvailable = function () {
|
|
@@ -2160,7 +2157,7 @@ var inMemoryPersistence = InMemoryPersistence;
|
|
|
2160
2157
|
* limitations under the License.
|
|
2161
2158
|
*/
|
|
2162
2159
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
2163
|
-
return "firebase" /* PERSISTENCE
|
|
2160
|
+
return "".concat("firebase" /* Namespace.PERSISTENCE */, ":").concat(key, ":").concat(apiKey, ":").concat(appName);
|
|
2164
2161
|
}
|
|
2165
2162
|
var PersistenceUserManager = /** @class */ (function () {
|
|
2166
2163
|
function PersistenceUserManager(persistence, auth, userKey) {
|
|
@@ -2169,7 +2166,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2169
2166
|
this.userKey = userKey;
|
|
2170
2167
|
var _a = this.auth, config = _a.config, name = _a.name;
|
|
2171
2168
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
2172
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
2169
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
2173
2170
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
2174
2171
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
2175
2172
|
}
|
|
@@ -2223,7 +2220,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2223
2220
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
2224
2221
|
};
|
|
2225
2222
|
PersistenceUserManager.create = function (auth, persistenceHierarchy, userKey) {
|
|
2226
|
-
if (userKey === void 0) { userKey = "authUser" /* AUTH_USER */; }
|
|
2223
|
+
if (userKey === void 0) { userKey = "authUser" /* KeyName.AUTH_USER */; }
|
|
2227
2224
|
return __awaiter(this, void 0, void 0, function () {
|
|
2228
2225
|
var availablePersistences, selectedPersistence, key, userToMigrate, _i, persistenceHierarchy_1, persistence, blob, user, migrationHierarchy;
|
|
2229
2226
|
var _this = this;
|
|
@@ -2378,43 +2375,42 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2378
2375
|
};
|
|
2379
2376
|
};
|
|
2380
2377
|
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2381
|
-
var _a;
|
|
2382
2378
|
return __awaiter(this, void 0, void 0, function () {
|
|
2383
|
-
var onAbortStack, _i,
|
|
2384
|
-
return __generator(this, function (
|
|
2385
|
-
switch (
|
|
2379
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2380
|
+
return __generator(this, function (_c) {
|
|
2381
|
+
switch (_c.label) {
|
|
2386
2382
|
case 0:
|
|
2387
2383
|
if (this.auth.currentUser === nextUser) {
|
|
2388
2384
|
return [2 /*return*/];
|
|
2389
2385
|
}
|
|
2390
2386
|
onAbortStack = [];
|
|
2391
|
-
|
|
2387
|
+
_c.label = 1;
|
|
2392
2388
|
case 1:
|
|
2393
|
-
|
|
2394
|
-
_i = 0,
|
|
2395
|
-
|
|
2389
|
+
_c.trys.push([1, 6, , 7]);
|
|
2390
|
+
_i = 0, _a = this.queue;
|
|
2391
|
+
_c.label = 2;
|
|
2396
2392
|
case 2:
|
|
2397
|
-
if (!(_i <
|
|
2398
|
-
beforeStateCallback =
|
|
2393
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2394
|
+
beforeStateCallback = _a[_i];
|
|
2399
2395
|
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2400
2396
|
case 3:
|
|
2401
|
-
|
|
2397
|
+
_c.sent();
|
|
2402
2398
|
// Only push the onAbort if the callback succeeds
|
|
2403
2399
|
if (beforeStateCallback.onAbort) {
|
|
2404
2400
|
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2405
2401
|
}
|
|
2406
|
-
|
|
2402
|
+
_c.label = 4;
|
|
2407
2403
|
case 4:
|
|
2408
2404
|
_i++;
|
|
2409
2405
|
return [3 /*break*/, 2];
|
|
2410
2406
|
case 5: return [3 /*break*/, 7];
|
|
2411
2407
|
case 6:
|
|
2412
|
-
e_1 =
|
|
2408
|
+
e_1 = _c.sent();
|
|
2413
2409
|
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2414
2410
|
// continue
|
|
2415
2411
|
onAbortStack.reverse();
|
|
2416
|
-
for (
|
|
2417
|
-
onAbort = onAbortStack_1[
|
|
2412
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2413
|
+
onAbort = onAbortStack_1[_b];
|
|
2418
2414
|
try {
|
|
2419
2415
|
onAbort();
|
|
2420
2416
|
}
|
|
@@ -2422,8 +2418,8 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2422
2418
|
/* swallow error */
|
|
2423
2419
|
}
|
|
2424
2420
|
}
|
|
2425
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2426
|
-
originalMessage:
|
|
2421
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2422
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2427
2423
|
});
|
|
2428
2424
|
case 7: return [2 /*return*/];
|
|
2429
2425
|
}
|
|
@@ -2633,7 +2629,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2633
2629
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
2634
2630
|
}
|
|
2635
2631
|
case 9:
|
|
2636
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2632
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2637
2633
|
return [4 /*yield*/, this.getOrInitRedirectPersistenceManager()];
|
|
2638
2634
|
case 10:
|
|
2639
2635
|
_b.sent();
|
|
@@ -2681,21 +2677,20 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2681
2677
|
});
|
|
2682
2678
|
};
|
|
2683
2679
|
AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
|
|
2684
|
-
var _a;
|
|
2685
2680
|
return __awaiter(this, void 0, void 0, function () {
|
|
2686
2681
|
var e_4;
|
|
2687
|
-
return __generator(this, function (
|
|
2688
|
-
switch (
|
|
2682
|
+
return __generator(this, function (_a) {
|
|
2683
|
+
switch (_a.label) {
|
|
2689
2684
|
case 0:
|
|
2690
|
-
|
|
2685
|
+
_a.trys.push([0, 2, , 3]);
|
|
2691
2686
|
return [4 /*yield*/, _reloadWithoutSaving(user)];
|
|
2692
2687
|
case 1:
|
|
2693
|
-
|
|
2688
|
+
_a.sent();
|
|
2694
2689
|
return [3 /*break*/, 3];
|
|
2695
2690
|
case 2:
|
|
2696
|
-
e_4 =
|
|
2697
|
-
if ((
|
|
2698
|
-
"auth/"
|
|
2691
|
+
e_4 = _a.sent();
|
|
2692
|
+
if ((e_4 === null || e_4 === void 0 ? void 0 : e_4.code) !==
|
|
2693
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
2699
2694
|
// Something's wrong with the user's token. Log them out and remove
|
|
2700
2695
|
// them from storage
|
|
2701
2696
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
@@ -2725,7 +2720,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2725
2720
|
? getModularInstance(userExtern)
|
|
2726
2721
|
: null;
|
|
2727
2722
|
if (user) {
|
|
2728
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2723
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2729
2724
|
}
|
|
2730
2725
|
return [2 /*return*/, this._updateCurrentUser(user && user._clone(this))];
|
|
2731
2726
|
});
|
|
@@ -2742,7 +2737,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2742
2737
|
return [2 /*return*/];
|
|
2743
2738
|
}
|
|
2744
2739
|
if (user) {
|
|
2745
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2740
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2746
2741
|
}
|
|
2747
2742
|
if (!!skipBeforeStateCallbacks) return [3 /*break*/, 2];
|
|
2748
2743
|
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(user)];
|
|
@@ -2848,9 +2843,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2848
2843
|
if (!!this.redirectPersistenceManager) return [3 /*break*/, 3];
|
|
2849
2844
|
resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
2850
2845
|
this._popupRedirectResolver;
|
|
2851
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2846
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2852
2847
|
_a = this;
|
|
2853
|
-
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */)];
|
|
2848
|
+
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */)];
|
|
2854
2849
|
case 1:
|
|
2855
2850
|
_a.redirectPersistenceManager = _c.sent();
|
|
2856
2851
|
_b = this;
|
|
@@ -2910,7 +2905,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2910
2905
|
}
|
|
2911
2906
|
};
|
|
2912
2907
|
AuthImpl.prototype._key = function () {
|
|
2913
|
-
return this.config.authDomain
|
|
2908
|
+
return "".concat(this.config.authDomain, ":").concat(this.config.apiKey, ":").concat(this.name);
|
|
2914
2909
|
};
|
|
2915
2910
|
AuthImpl.prototype._startProactiveRefresh = function () {
|
|
2916
2911
|
this.isProactiveRefreshEnabled = true;
|
|
@@ -2955,7 +2950,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2955
2950
|
var promise = this._isInitialized
|
|
2956
2951
|
? Promise.resolve()
|
|
2957
2952
|
: this._initializationPromise;
|
|
2958
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
2953
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2959
2954
|
// The callback needs to be called asynchronously per the spec.
|
|
2960
2955
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2961
2956
|
promise.then(function () { return cb(_this.currentUser); });
|
|
@@ -3005,7 +3000,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3005
3000
|
};
|
|
3006
3001
|
Object.defineProperty(AuthImpl.prototype, "assertedPersistence", {
|
|
3007
3002
|
get: function () {
|
|
3008
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3003
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3009
3004
|
return this.persistenceManager;
|
|
3010
3005
|
},
|
|
3011
3006
|
enumerable: false,
|
|
@@ -3033,10 +3028,10 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3033
3028
|
switch (_c.label) {
|
|
3034
3029
|
case 0:
|
|
3035
3030
|
headers = (_b = {},
|
|
3036
|
-
_b["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
|
|
3031
|
+
_b["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */] = this.clientVersion,
|
|
3037
3032
|
_b);
|
|
3038
3033
|
if (this.app.options.appId) {
|
|
3039
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3034
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3040
3035
|
}
|
|
3041
3036
|
return [4 /*yield*/, ((_a = this.heartbeatServiceProvider
|
|
3042
3037
|
.getImmediate({
|
|
@@ -3045,7 +3040,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3045
3040
|
case 1:
|
|
3046
3041
|
heartbeatsHeader = _c.sent();
|
|
3047
3042
|
if (heartbeatsHeader) {
|
|
3048
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3043
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3049
3044
|
}
|
|
3050
3045
|
return [2 /*return*/, headers];
|
|
3051
3046
|
}
|
|
@@ -3073,7 +3068,7 @@ var Subscription = /** @class */ (function () {
|
|
|
3073
3068
|
}
|
|
3074
3069
|
Object.defineProperty(Subscription.prototype, "next", {
|
|
3075
3070
|
get: function () {
|
|
3076
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3071
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3077
3072
|
return this.observer.next.bind(this.observer);
|
|
3078
3073
|
},
|
|
3079
3074
|
enumerable: false,
|
|
@@ -3135,8 +3130,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
3135
3130
|
return;
|
|
3136
3131
|
}
|
|
3137
3132
|
var unsubscribe = this.auth.onIdTokenChanged(function (user) {
|
|
3138
|
-
|
|
3139
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
3133
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
3140
3134
|
});
|
|
3141
3135
|
this.internalListeners.set(listener, unsubscribe);
|
|
3142
3136
|
this.updateProactiveRefresh();
|
|
@@ -3152,7 +3146,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
3152
3146
|
this.updateProactiveRefresh();
|
|
3153
3147
|
};
|
|
3154
3148
|
AuthInterop.prototype.assertAuthConfigured = function () {
|
|
3155
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
3149
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
3156
3150
|
};
|
|
3157
3151
|
AuthInterop.prototype.updateProactiveRefresh = function () {
|
|
3158
3152
|
if (this.internalListeners.size > 0) {
|
|
@@ -3183,13 +3177,13 @@ var AuthInterop = /** @class */ (function () {
|
|
|
3183
3177
|
*/
|
|
3184
3178
|
function getVersionForPlatform(clientPlatform) {
|
|
3185
3179
|
switch (clientPlatform) {
|
|
3186
|
-
case "Node" /* NODE */:
|
|
3180
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
3187
3181
|
return 'node';
|
|
3188
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
3182
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
3189
3183
|
return 'rn';
|
|
3190
|
-
case "Worker" /* WORKER */:
|
|
3184
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
3191
3185
|
return 'webworker';
|
|
3192
|
-
case "Cordova" /* CORDOVA */:
|
|
3186
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
3193
3187
|
return 'cordova';
|
|
3194
3188
|
default:
|
|
3195
3189
|
return undefined;
|
|
@@ -3197,48 +3191,48 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
3197
3191
|
}
|
|
3198
3192
|
/** @internal */
|
|
3199
3193
|
function registerAuth(clientPlatform) {
|
|
3200
|
-
_registerComponent(new Component("auth" /* AUTH */, function (container, _a) {
|
|
3194
|
+
_registerComponent(new Component("auth" /* _ComponentName.AUTH */, function (container, _a) {
|
|
3201
3195
|
var deps = _a.options;
|
|
3202
3196
|
var app = container.getProvider('app').getImmediate();
|
|
3203
3197
|
var heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
3204
3198
|
var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
|
|
3205
3199
|
return (function (app, heartbeatServiceProvider) {
|
|
3206
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
3200
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
3207
3201
|
// Auth domain is optional if IdP sign in isn't being used
|
|
3208
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
3202
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
3209
3203
|
appName: app.name
|
|
3210
3204
|
});
|
|
3211
3205
|
var config = {
|
|
3212
3206
|
apiKey: apiKey,
|
|
3213
3207
|
authDomain: authDomain,
|
|
3214
3208
|
clientPlatform: clientPlatform,
|
|
3215
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
3216
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
3217
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
3209
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
3210
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
3211
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
3218
3212
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
3219
3213
|
};
|
|
3220
3214
|
var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
3221
3215
|
_initializeAuthInstance(authInstance, deps);
|
|
3222
3216
|
return authInstance;
|
|
3223
3217
|
})(app, heartbeatServiceProvider);
|
|
3224
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
3218
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
3225
3219
|
/**
|
|
3226
3220
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
3227
3221
|
* For why we do this, See go/firebase-next-auth-init
|
|
3228
3222
|
*/
|
|
3229
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
3223
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
3230
3224
|
/**
|
|
3231
3225
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
3232
3226
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
3233
3227
|
*/
|
|
3234
3228
|
.setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {
|
|
3235
|
-
var authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
3229
|
+
var authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
3236
3230
|
authInternalProvider.initialize();
|
|
3237
3231
|
}));
|
|
3238
|
-
_registerComponent(new Component("auth-internal" /* AUTH_INTERNAL */, function (container) {
|
|
3239
|
-
var auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
3232
|
+
_registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, function (container) {
|
|
3233
|
+
var auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
3240
3234
|
return (function (auth) { return new AuthInterop(auth); })(auth);
|
|
3241
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
3235
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
3242
3236
|
registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
3243
3237
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
3244
3238
|
registerVersion(name, version, 'esm5');
|
|
@@ -3367,7 +3361,7 @@ var Receiver = /** @class */ (function () {
|
|
|
3367
3361
|
return [2 /*return*/];
|
|
3368
3362
|
}
|
|
3369
3363
|
messageEvent.ports[0].postMessage({
|
|
3370
|
-
status: "ack" /* ACK */,
|
|
3364
|
+
status: "ack" /* _Status.ACK */,
|
|
3371
3365
|
eventId: eventId,
|
|
3372
3366
|
eventType: eventType
|
|
3373
3367
|
});
|
|
@@ -3378,7 +3372,7 @@ var Receiver = /** @class */ (function () {
|
|
|
3378
3372
|
case 1:
|
|
3379
3373
|
response = _b.sent();
|
|
3380
3374
|
messageEvent.ports[0].postMessage({
|
|
3381
|
-
status: "done" /* DONE */,
|
|
3375
|
+
status: "done" /* _Status.DONE */,
|
|
3382
3376
|
eventId: eventId,
|
|
3383
3377
|
eventType: eventType,
|
|
3384
3378
|
response: response
|
|
@@ -3503,20 +3497,20 @@ var Sender = /** @class */ (function () {
|
|
|
3503
3497
|
* @returns An array of settled promises from all the handlers that were listening on the receiver.
|
|
3504
3498
|
*/
|
|
3505
3499
|
Sender.prototype._send = function (eventType, data, timeout) {
|
|
3506
|
-
if (timeout === void 0) { timeout = 50 /* ACK */; }
|
|
3500
|
+
if (timeout === void 0) { timeout = 50 /* _TimeoutDuration.ACK */; }
|
|
3507
3501
|
return __awaiter(this, void 0, void 0, function () {
|
|
3508
3502
|
var messageChannel, completionTimer, handler;
|
|
3509
3503
|
var _this = this;
|
|
3510
3504
|
return __generator(this, function (_a) {
|
|
3511
3505
|
messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;
|
|
3512
3506
|
if (!messageChannel) {
|
|
3513
|
-
throw new Error("connection_unavailable" /* CONNECTION_UNAVAILABLE */);
|
|
3507
|
+
throw new Error("connection_unavailable" /* _MessageError.CONNECTION_UNAVAILABLE */);
|
|
3514
3508
|
}
|
|
3515
3509
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
3516
3510
|
var eventId = _generateEventId('', 20);
|
|
3517
3511
|
messageChannel.port1.start();
|
|
3518
3512
|
var ackTimer = setTimeout(function () {
|
|
3519
|
-
reject(new Error("unsupported_event" /* UNSUPPORTED_EVENT */));
|
|
3513
|
+
reject(new Error("unsupported_event" /* _MessageError.UNSUPPORTED_EVENT */));
|
|
3520
3514
|
}, timeout);
|
|
3521
3515
|
handler = {
|
|
3522
3516
|
messageChannel: messageChannel,
|
|
@@ -3526,14 +3520,14 @@ var Sender = /** @class */ (function () {
|
|
|
3526
3520
|
return;
|
|
3527
3521
|
}
|
|
3528
3522
|
switch (messageEvent.data.status) {
|
|
3529
|
-
case "ack" /* ACK */:
|
|
3523
|
+
case "ack" /* _Status.ACK */:
|
|
3530
3524
|
// The receiver should ACK first.
|
|
3531
3525
|
clearTimeout(ackTimer);
|
|
3532
3526
|
completionTimer = setTimeout(function () {
|
|
3533
|
-
reject(new Error("timeout" /* TIMEOUT */));
|
|
3534
|
-
}, 3000 /* COMPLETION */);
|
|
3527
|
+
reject(new Error("timeout" /* _MessageError.TIMEOUT */));
|
|
3528
|
+
}, 3000 /* _TimeoutDuration.COMPLETION */);
|
|
3535
3529
|
break;
|
|
3536
|
-
case "done" /* DONE */:
|
|
3530
|
+
case "done" /* _Status.DONE */:
|
|
3537
3531
|
// Once the receiver's handlers are finished we will get the results.
|
|
3538
3532
|
clearTimeout(completionTimer);
|
|
3539
3533
|
resolve(messageEvent.data.response);
|
|
@@ -3541,7 +3535,7 @@ var Sender = /** @class */ (function () {
|
|
|
3541
3535
|
default:
|
|
3542
3536
|
clearTimeout(ackTimer);
|
|
3543
3537
|
clearTimeout(completionTimer);
|
|
3544
|
-
reject(new Error("invalid_response" /* INVALID_RESPONSE */));
|
|
3538
|
+
reject(new Error("invalid_response" /* _MessageError.INVALID_RESPONSE */));
|
|
3545
3539
|
break;
|
|
3546
3540
|
}
|
|
3547
3541
|
}
|
|
@@ -3770,7 +3764,7 @@ var _POLLING_INTERVAL_MS = 800;
|
|
|
3770
3764
|
var _TRANSACTION_RETRY_COUNT = 3;
|
|
3771
3765
|
var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
3772
3766
|
function IndexedDBLocalPersistence() {
|
|
3773
|
-
this.type = "LOCAL" /* LOCAL */;
|
|
3767
|
+
this.type = "LOCAL" /* PersistenceType.LOCAL */;
|
|
3774
3768
|
this._shouldAllowMigration = true;
|
|
3775
3769
|
this.listeners = {};
|
|
3776
3770
|
this.localCache = {};
|
|
@@ -3857,7 +3851,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
3857
3851
|
return __generator(this, function (_a) {
|
|
3858
3852
|
this.receiver = Receiver._getInstance(_getWorkerGlobalScope());
|
|
3859
3853
|
// Refresh from persistence if we receive a KeyChanged message.
|
|
3860
|
-
this.receiver._subscribe("keyChanged" /* KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
3854
|
+
this.receiver._subscribe("keyChanged" /* _EventType.KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
3861
3855
|
var keys;
|
|
3862
3856
|
return __generator(this, function (_a) {
|
|
3863
3857
|
switch (_a.label) {
|
|
@@ -3871,9 +3865,9 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
3871
3865
|
});
|
|
3872
3866
|
}); });
|
|
3873
3867
|
// Let the sender know that we are listening so they give us more timeout.
|
|
3874
|
-
this.receiver._subscribe("ping" /* PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
3868
|
+
this.receiver._subscribe("ping" /* _EventType.PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
3875
3869
|
return __generator(this, function (_a) {
|
|
3876
|
-
return [2 /*return*/, ["keyChanged" /* KEY_CHANGED */]];
|
|
3870
|
+
return [2 /*return*/, ["keyChanged" /* _EventType.KEY_CHANGED */]];
|
|
3877
3871
|
});
|
|
3878
3872
|
}); });
|
|
3879
3873
|
return [2 /*return*/];
|
|
@@ -3904,14 +3898,14 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
3904
3898
|
return [2 /*return*/];
|
|
3905
3899
|
}
|
|
3906
3900
|
this.sender = new Sender(this.activeServiceWorker);
|
|
3907
|
-
return [4 /*yield*/, this.sender._send("ping" /* PING */, {}, 800 /* LONG_ACK */)];
|
|
3901
|
+
return [4 /*yield*/, this.sender._send("ping" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */)];
|
|
3908
3902
|
case 2:
|
|
3909
3903
|
results = _d.sent();
|
|
3910
3904
|
if (!results) {
|
|
3911
3905
|
return [2 /*return*/];
|
|
3912
3906
|
}
|
|
3913
3907
|
if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&
|
|
3914
|
-
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* KEY_CHANGED */))) {
|
|
3908
|
+
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* _EventType.KEY_CHANGED */))) {
|
|
3915
3909
|
this.serviceWorkerReceiverAvailable = true;
|
|
3916
3910
|
}
|
|
3917
3911
|
return [2 /*return*/];
|
|
@@ -3941,11 +3935,11 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
3941
3935
|
_b.label = 1;
|
|
3942
3936
|
case 1:
|
|
3943
3937
|
_b.trys.push([1, 3, , 4]);
|
|
3944
|
-
return [4 /*yield*/, this.sender._send("keyChanged" /* KEY_CHANGED */, { key: key },
|
|
3938
|
+
return [4 /*yield*/, this.sender._send("keyChanged" /* _EventType.KEY_CHANGED */, { key: key },
|
|
3945
3939
|
// Use long timeout if receiver has previously responded to a ping from us.
|
|
3946
3940
|
this.serviceWorkerReceiverAvailable
|
|
3947
|
-
? 800 /* LONG_ACK */
|
|
3948
|
-
: 50 /* ACK */)];
|
|
3941
|
+
? 800 /* _TimeoutDuration.LONG_ACK */
|
|
3942
|
+
: 50 /* _TimeoutDuration.ACK */)];
|
|
3949
3943
|
case 2:
|
|
3950
3944
|
_b.sent();
|
|
3951
3945
|
return [3 /*break*/, 4];
|
|
@@ -4277,14 +4271,14 @@ var ActionCodeOperation = {
|
|
|
4277
4271
|
*/
|
|
4278
4272
|
function connectAuthEmulator(auth, url, options) {
|
|
4279
4273
|
var authInternal = _castAuth(auth);
|
|
4280
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
4281
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
4274
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
4275
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
4282
4276
|
var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
4283
4277
|
var protocol = extractProtocol(url);
|
|
4284
4278
|
var _a = extractHostAndPort(url), host = _a.host, port = _a.port;
|
|
4285
|
-
var portStr = port === null ? '' : ":"
|
|
4279
|
+
var portStr = port === null ? '' : ":".concat(port);
|
|
4286
4280
|
// Always replace path with "/" (even if input url had no path at all, or had a different one).
|
|
4287
|
-
authInternal.config.emulator = { url: protocol
|
|
4281
|
+
authInternal.config.emulator = { url: "".concat(protocol, "//").concat(host).concat(portStr, "/") };
|
|
4288
4282
|
authInternal.settings.appVerificationDisabledForTesting = true;
|
|
4289
4283
|
authInternal.emulatorConfig = Object.freeze({
|
|
4290
4284
|
host: host,
|
|
@@ -4449,21 +4443,21 @@ var AuthCredential = /** @class */ (function () {
|
|
|
4449
4443
|
function resetPassword(auth, request) {
|
|
4450
4444
|
return __awaiter(this, void 0, void 0, function () {
|
|
4451
4445
|
return __generator(this, function (_a) {
|
|
4452
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4446
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4453
4447
|
});
|
|
4454
4448
|
});
|
|
4455
4449
|
}
|
|
4456
4450
|
function updateEmailPassword(auth, request) {
|
|
4457
4451
|
return __awaiter(this, void 0, void 0, function () {
|
|
4458
4452
|
return __generator(this, function (_a) {
|
|
4459
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
4453
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
4460
4454
|
});
|
|
4461
4455
|
});
|
|
4462
4456
|
}
|
|
4463
4457
|
function applyActionCode$1(auth, request) {
|
|
4464
4458
|
return __awaiter(this, void 0, void 0, function () {
|
|
4465
4459
|
return __generator(this, function (_a) {
|
|
4466
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
4460
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
4467
4461
|
});
|
|
4468
4462
|
});
|
|
4469
4463
|
}
|
|
@@ -4487,14 +4481,14 @@ function applyActionCode$1(auth, request) {
|
|
|
4487
4481
|
function signInWithPassword(auth, request) {
|
|
4488
4482
|
return __awaiter(this, void 0, void 0, function () {
|
|
4489
4483
|
return __generator(this, function (_a) {
|
|
4490
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4484
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4491
4485
|
});
|
|
4492
4486
|
});
|
|
4493
4487
|
}
|
|
4494
4488
|
function sendOobCode(auth, request) {
|
|
4495
4489
|
return __awaiter(this, void 0, void 0, function () {
|
|
4496
4490
|
return __generator(this, function (_a) {
|
|
4497
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
4491
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
4498
4492
|
});
|
|
4499
4493
|
});
|
|
4500
4494
|
}
|
|
@@ -4546,14 +4540,14 @@ function verifyAndChangeEmail(auth, request) {
|
|
|
4546
4540
|
function signInWithEmailLink$1(auth, request) {
|
|
4547
4541
|
return __awaiter(this, void 0, void 0, function () {
|
|
4548
4542
|
return __generator(this, function (_a) {
|
|
4549
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4543
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4550
4544
|
});
|
|
4551
4545
|
});
|
|
4552
4546
|
}
|
|
4553
4547
|
function signInWithEmailLinkForLinking(auth, request) {
|
|
4554
4548
|
return __awaiter(this, void 0, void 0, function () {
|
|
4555
4549
|
return __generator(this, function (_a) {
|
|
4556
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4550
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4557
4551
|
});
|
|
4558
4552
|
});
|
|
4559
4553
|
}
|
|
@@ -4595,7 +4589,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4595
4589
|
/** @internal */
|
|
4596
4590
|
_tenantId) {
|
|
4597
4591
|
if (_tenantId === void 0) { _tenantId = null; }
|
|
4598
|
-
var _this = _super.call(this, "password" /* PASSWORD */, signInMethod) || this;
|
|
4592
|
+
var _this = _super.call(this, "password" /* ProviderId.PASSWORD */, signInMethod) || this;
|
|
4599
4593
|
_this._email = _email;
|
|
4600
4594
|
_this._password = _password;
|
|
4601
4595
|
_this._tenantId = _tenantId;
|
|
@@ -4603,12 +4597,12 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4603
4597
|
}
|
|
4604
4598
|
/** @internal */
|
|
4605
4599
|
EmailAuthCredential._fromEmailAndPassword = function (email, password) {
|
|
4606
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
4600
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
4607
4601
|
};
|
|
4608
4602
|
/** @internal */
|
|
4609
4603
|
EmailAuthCredential._fromEmailAndCode = function (email, oobCode, tenantId) {
|
|
4610
4604
|
if (tenantId === void 0) { tenantId = null; }
|
|
4611
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
4605
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
4612
4606
|
};
|
|
4613
4607
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
4614
4608
|
EmailAuthCredential.prototype.toJSON = function () {
|
|
@@ -4630,10 +4624,10 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4630
4624
|
EmailAuthCredential.fromJSON = function (json) {
|
|
4631
4625
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
4632
4626
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
4633
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
4627
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
4634
4628
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
4635
4629
|
}
|
|
4636
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
4630
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
4637
4631
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
4638
4632
|
}
|
|
4639
4633
|
}
|
|
@@ -4644,19 +4638,19 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4644
4638
|
return __awaiter(this, void 0, void 0, function () {
|
|
4645
4639
|
return __generator(this, function (_a) {
|
|
4646
4640
|
switch (this.signInMethod) {
|
|
4647
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
4641
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
4648
4642
|
return [2 /*return*/, signInWithPassword(auth, {
|
|
4649
4643
|
returnSecureToken: true,
|
|
4650
4644
|
email: this._email,
|
|
4651
4645
|
password: this._password
|
|
4652
4646
|
})];
|
|
4653
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
4647
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
4654
4648
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
4655
4649
|
email: this._email,
|
|
4656
4650
|
oobCode: this._password
|
|
4657
4651
|
})];
|
|
4658
4652
|
default:
|
|
4659
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4653
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4660
4654
|
}
|
|
4661
4655
|
return [2 /*return*/];
|
|
4662
4656
|
});
|
|
@@ -4667,21 +4661,21 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4667
4661
|
return __awaiter(this, void 0, void 0, function () {
|
|
4668
4662
|
return __generator(this, function (_a) {
|
|
4669
4663
|
switch (this.signInMethod) {
|
|
4670
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
4664
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
4671
4665
|
return [2 /*return*/, updateEmailPassword(auth, {
|
|
4672
4666
|
idToken: idToken,
|
|
4673
4667
|
returnSecureToken: true,
|
|
4674
4668
|
email: this._email,
|
|
4675
4669
|
password: this._password
|
|
4676
4670
|
})];
|
|
4677
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
4671
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
4678
4672
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
4679
4673
|
idToken: idToken,
|
|
4680
4674
|
email: this._email,
|
|
4681
4675
|
oobCode: this._password
|
|
4682
4676
|
})];
|
|
4683
4677
|
default:
|
|
4684
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4678
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4685
4679
|
}
|
|
4686
4680
|
return [2 /*return*/];
|
|
4687
4681
|
});
|
|
@@ -4713,7 +4707,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4713
4707
|
function signInWithIdp(auth, request) {
|
|
4714
4708
|
return __awaiter(this, void 0, void 0, function () {
|
|
4715
4709
|
return __generator(this, function (_a) {
|
|
4716
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
4710
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
4717
4711
|
});
|
|
4718
4712
|
});
|
|
4719
4713
|
}
|
|
@@ -4775,7 +4769,7 @@ var OAuthCredential = /** @class */ (function (_super) {
|
|
|
4775
4769
|
cred.secret = params.oauthTokenSecret;
|
|
4776
4770
|
}
|
|
4777
4771
|
else {
|
|
4778
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
4772
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4779
4773
|
}
|
|
4780
4774
|
return cred;
|
|
4781
4775
|
};
|
|
@@ -4881,7 +4875,7 @@ var _a;
|
|
|
4881
4875
|
function signInWithPhoneNumber(auth, request) {
|
|
4882
4876
|
return __awaiter(this, void 0, void 0, function () {
|
|
4883
4877
|
return __generator(this, function (_a) {
|
|
4884
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4878
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4885
4879
|
});
|
|
4886
4880
|
});
|
|
4887
4881
|
}
|
|
@@ -4890,11 +4884,11 @@ function linkWithPhoneNumber(auth, request) {
|
|
|
4890
4884
|
var response;
|
|
4891
4885
|
return __generator(this, function (_a) {
|
|
4892
4886
|
switch (_a.label) {
|
|
4893
|
-
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4887
|
+
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4894
4888
|
case 1:
|
|
4895
4889
|
response = _a.sent();
|
|
4896
4890
|
if (response.temporaryProof) {
|
|
4897
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
4891
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
4898
4892
|
}
|
|
4899
4893
|
return [2 /*return*/, response];
|
|
4900
4894
|
}
|
|
@@ -4902,14 +4896,14 @@ function linkWithPhoneNumber(auth, request) {
|
|
|
4902
4896
|
});
|
|
4903
4897
|
}
|
|
4904
4898
|
var VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = (_a = {},
|
|
4905
|
-
_a["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
4899
|
+
_a["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
4906
4900
|
_a);
|
|
4907
4901
|
function verifyPhoneNumberForExisting(auth, request) {
|
|
4908
4902
|
return __awaiter(this, void 0, void 0, function () {
|
|
4909
4903
|
var apiRequest;
|
|
4910
4904
|
return __generator(this, function (_a) {
|
|
4911
4905
|
apiRequest = __assign(__assign({}, request), { operation: 'REAUTH' });
|
|
4912
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
4906
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
4913
4907
|
});
|
|
4914
4908
|
});
|
|
4915
4909
|
}
|
|
@@ -4938,7 +4932,7 @@ function verifyPhoneNumberForExisting(auth, request) {
|
|
|
4938
4932
|
var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
4939
4933
|
__extends(PhoneAuthCredential, _super);
|
|
4940
4934
|
function PhoneAuthCredential(params) {
|
|
4941
|
-
var _this = _super.call(this, "phone" /* PHONE */, "phone" /* PHONE */) || this;
|
|
4935
|
+
var _this = _super.call(this, "phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */) || this;
|
|
4942
4936
|
_this.params = params;
|
|
4943
4937
|
return _this;
|
|
4944
4938
|
}
|
|
@@ -5038,17 +5032,17 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
|
5038
5032
|
function parseMode(mode) {
|
|
5039
5033
|
switch (mode) {
|
|
5040
5034
|
case 'recoverEmail':
|
|
5041
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
5035
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
5042
5036
|
case 'resetPassword':
|
|
5043
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
5037
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
5044
5038
|
case 'signIn':
|
|
5045
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
5039
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
5046
5040
|
case 'verifyEmail':
|
|
5047
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
5041
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
5048
5042
|
case 'verifyAndChangeEmail':
|
|
5049
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
5043
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
5050
5044
|
case 'revertSecondFactorAddition':
|
|
5051
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
5045
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
5052
5046
|
default:
|
|
5053
5047
|
return null;
|
|
5054
5048
|
}
|
|
@@ -5087,17 +5081,17 @@ var ActionCodeURL = /** @class */ (function () {
|
|
|
5087
5081
|
function ActionCodeURL(actionLink) {
|
|
5088
5082
|
var _a, _b, _c, _d, _e, _f;
|
|
5089
5083
|
var searchParams = querystringDecode(extractQuerystring(actionLink));
|
|
5090
|
-
var apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
5091
|
-
var code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
5092
|
-
var operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
5084
|
+
var apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
5085
|
+
var code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
5086
|
+
var operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
5093
5087
|
// Validate API key, code and mode.
|
|
5094
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
5088
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5095
5089
|
this.apiKey = apiKey;
|
|
5096
5090
|
this.operation = operation;
|
|
5097
5091
|
this.code = code;
|
|
5098
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
5099
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
5100
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
5092
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
5093
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
5094
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
5101
5095
|
}
|
|
5102
5096
|
/**
|
|
5103
5097
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -5202,21 +5196,21 @@ var EmailAuthProvider = /** @class */ (function () {
|
|
|
5202
5196
|
*/
|
|
5203
5197
|
EmailAuthProvider.credentialWithLink = function (email, emailLink) {
|
|
5204
5198
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
5205
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
5199
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5206
5200
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
5207
5201
|
};
|
|
5208
5202
|
/**
|
|
5209
5203
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
5210
5204
|
*/
|
|
5211
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
5205
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
5212
5206
|
/**
|
|
5213
5207
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
5214
5208
|
*/
|
|
5215
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
5209
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
5216
5210
|
/**
|
|
5217
5211
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
5218
5212
|
*/
|
|
5219
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
5213
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
5220
5214
|
return EmailAuthProvider;
|
|
5221
5215
|
}());
|
|
5222
5216
|
|
|
@@ -5333,7 +5327,7 @@ var BaseOAuthProvider = /** @class */ (function (_super) {
|
|
|
5333
5327
|
* Retrieve the current list of OAuth scopes.
|
|
5334
5328
|
*/
|
|
5335
5329
|
BaseOAuthProvider.prototype.getScopes = function () {
|
|
5336
|
-
return __spreadArray([], this.scopes);
|
|
5330
|
+
return __spreadArray([], this.scopes, true);
|
|
5337
5331
|
};
|
|
5338
5332
|
return BaseOAuthProvider;
|
|
5339
5333
|
}(FederatedAuthProvider));
|
|
@@ -5388,7 +5382,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5388
5382
|
*/
|
|
5389
5383
|
OAuthProvider.credentialFromJSON = function (json) {
|
|
5390
5384
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
5391
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
5385
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5392
5386
|
return OAuthCredential._fromParams(obj);
|
|
5393
5387
|
};
|
|
5394
5388
|
/**
|
|
@@ -5417,7 +5411,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5417
5411
|
};
|
|
5418
5412
|
/** An internal credential method that accepts more permissive options */
|
|
5419
5413
|
OAuthProvider.prototype._credential = function (params) {
|
|
5420
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
5414
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5421
5415
|
// For OAuthCredential, sign in method is same as providerId.
|
|
5422
5416
|
return OAuthCredential._fromParams(__assign(__assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
5423
5417
|
};
|
|
@@ -5526,7 +5520,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5526
5520
|
var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
5527
5521
|
__extends(FacebookAuthProvider, _super);
|
|
5528
5522
|
function FacebookAuthProvider() {
|
|
5529
|
-
return _super.call(this, "facebook.com" /* FACEBOOK */) || this;
|
|
5523
|
+
return _super.call(this, "facebook.com" /* ProviderId.FACEBOOK */) || this;
|
|
5530
5524
|
}
|
|
5531
5525
|
/**
|
|
5532
5526
|
* Creates a credential for Facebook.
|
|
@@ -5580,9 +5574,9 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
5580
5574
|
}
|
|
5581
5575
|
};
|
|
5582
5576
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
5583
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
5577
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
5584
5578
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
5585
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
5579
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
5586
5580
|
return FacebookAuthProvider;
|
|
5587
5581
|
}(BaseOAuthProvider));
|
|
5588
5582
|
|
|
@@ -5646,7 +5640,7 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
5646
5640
|
var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
5647
5641
|
__extends(GoogleAuthProvider, _super);
|
|
5648
5642
|
function GoogleAuthProvider() {
|
|
5649
|
-
var _this = _super.call(this, "google.com" /* GOOGLE */) || this;
|
|
5643
|
+
var _this = _super.call(this, "google.com" /* ProviderId.GOOGLE */) || this;
|
|
5650
5644
|
_this.addScope('profile');
|
|
5651
5645
|
return _this;
|
|
5652
5646
|
}
|
|
@@ -5706,9 +5700,9 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
5706
5700
|
}
|
|
5707
5701
|
};
|
|
5708
5702
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
5709
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
5703
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
5710
5704
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
5711
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
5705
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
5712
5706
|
return GoogleAuthProvider;
|
|
5713
5707
|
}(BaseOAuthProvider));
|
|
5714
5708
|
|
|
@@ -5773,7 +5767,7 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
5773
5767
|
var GithubAuthProvider = /** @class */ (function (_super) {
|
|
5774
5768
|
__extends(GithubAuthProvider, _super);
|
|
5775
5769
|
function GithubAuthProvider() {
|
|
5776
|
-
return _super.call(this, "github.com" /* GITHUB */) || this;
|
|
5770
|
+
return _super.call(this, "github.com" /* ProviderId.GITHUB */) || this;
|
|
5777
5771
|
}
|
|
5778
5772
|
/**
|
|
5779
5773
|
* Creates a credential for Github.
|
|
@@ -5820,9 +5814,9 @@ var GithubAuthProvider = /** @class */ (function (_super) {
|
|
|
5820
5814
|
}
|
|
5821
5815
|
};
|
|
5822
5816
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
5823
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
5817
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
5824
5818
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
5825
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
5819
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
5826
5820
|
return GithubAuthProvider;
|
|
5827
5821
|
}(BaseOAuthProvider));
|
|
5828
5822
|
|
|
@@ -5946,10 +5940,8 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5946
5940
|
* @param providerId - SAML provider ID.
|
|
5947
5941
|
*/
|
|
5948
5942
|
function SAMLAuthProvider(providerId) {
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
_this = _super.call(this, providerId) || this;
|
|
5952
|
-
return _this;
|
|
5943
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5944
|
+
return _super.call(this, providerId) || this;
|
|
5953
5945
|
}
|
|
5954
5946
|
/**
|
|
5955
5947
|
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
|
|
@@ -5985,7 +5977,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5985
5977
|
*/
|
|
5986
5978
|
SAMLAuthProvider.credentialFromJSON = function (json) {
|
|
5987
5979
|
var credential = SAMLAuthCredential.fromJSON(json);
|
|
5988
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
5980
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5989
5981
|
return credential;
|
|
5990
5982
|
};
|
|
5991
5983
|
SAMLAuthProvider.samlCredentialFromTaggedObject = function (_a) {
|
|
@@ -6065,7 +6057,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
6065
6057
|
var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
6066
6058
|
__extends(TwitterAuthProvider, _super);
|
|
6067
6059
|
function TwitterAuthProvider() {
|
|
6068
|
-
return _super.call(this, "twitter.com" /* TWITTER */) || this;
|
|
6060
|
+
return _super.call(this, "twitter.com" /* ProviderId.TWITTER */) || this;
|
|
6069
6061
|
}
|
|
6070
6062
|
/**
|
|
6071
6063
|
* Creates a credential for Twitter.
|
|
@@ -6115,9 +6107,9 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
6115
6107
|
}
|
|
6116
6108
|
};
|
|
6117
6109
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
6118
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
6110
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
6119
6111
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
6120
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
6112
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
6121
6113
|
return TwitterAuthProvider;
|
|
6122
6114
|
}(BaseOAuthProvider));
|
|
6123
6115
|
|
|
@@ -6140,7 +6132,7 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
6140
6132
|
function signUp(auth, request) {
|
|
6141
6133
|
return __awaiter(this, void 0, void 0, function () {
|
|
6142
6134
|
return __generator(this, function (_a) {
|
|
6143
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
6135
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
6144
6136
|
});
|
|
6145
6137
|
});
|
|
6146
6138
|
}
|
|
@@ -6215,7 +6207,7 @@ function providerIdForResponse(response) {
|
|
|
6215
6207
|
return response.providerId;
|
|
6216
6208
|
}
|
|
6217
6209
|
if ('phoneNumber' in response) {
|
|
6218
|
-
return "phone" /* PHONE */;
|
|
6210
|
+
return "phone" /* ProviderId.PHONE */;
|
|
6219
6211
|
}
|
|
6220
6212
|
return null;
|
|
6221
6213
|
}
|
|
@@ -6263,7 +6255,7 @@ function signInAnonymously(auth) {
|
|
|
6263
6255
|
return [2 /*return*/, new UserCredentialImpl({
|
|
6264
6256
|
user: authInternal.currentUser,
|
|
6265
6257
|
providerId: null,
|
|
6266
|
-
operationType: "signIn" /* SIGN_IN */
|
|
6258
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
6267
6259
|
})];
|
|
6268
6260
|
}
|
|
6269
6261
|
return [4 /*yield*/, signUp(authInternal, {
|
|
@@ -6271,7 +6263,7 @@ function signInAnonymously(auth) {
|
|
|
6271
6263
|
})];
|
|
6272
6264
|
case 2:
|
|
6273
6265
|
response = _b.sent();
|
|
6274
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true)];
|
|
6266
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true)];
|
|
6275
6267
|
case 3:
|
|
6276
6268
|
userCredential = _b.sent();
|
|
6277
6269
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -6302,8 +6294,9 @@ function signInAnonymously(auth) {
|
|
|
6302
6294
|
var MultiFactorError = /** @class */ (function (_super) {
|
|
6303
6295
|
__extends(MultiFactorError, _super);
|
|
6304
6296
|
function MultiFactorError(auth, error, operationType, user) {
|
|
6297
|
+
var _this = this;
|
|
6305
6298
|
var _a;
|
|
6306
|
-
|
|
6299
|
+
_this = _super.call(this, error.code, error.message) || this;
|
|
6307
6300
|
_this.operationType = operationType;
|
|
6308
6301
|
_this.user = user;
|
|
6309
6302
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -6322,11 +6315,11 @@ var MultiFactorError = /** @class */ (function (_super) {
|
|
|
6322
6315
|
return MultiFactorError;
|
|
6323
6316
|
}(FirebaseError));
|
|
6324
6317
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
6325
|
-
var idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
6318
|
+
var idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
6326
6319
|
? credential._getReauthenticationResolver(auth)
|
|
6327
6320
|
: credential._getIdTokenResponse(auth);
|
|
6328
6321
|
return idTokenProvider.catch(function (error) {
|
|
6329
|
-
if (error.code === "auth/"
|
|
6322
|
+
if (error.code === "auth/".concat("multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */)) {
|
|
6330
6323
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
6331
6324
|
}
|
|
6332
6325
|
throw error;
|
|
@@ -6409,7 +6402,7 @@ function unlink(user, providerId) {
|
|
|
6409
6402
|
userInternal.providerData = userInternal.providerData.filter(function (pd) {
|
|
6410
6403
|
return providersLeft.has(pd.providerId);
|
|
6411
6404
|
});
|
|
6412
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
6405
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
6413
6406
|
userInternal.phoneNumber = null;
|
|
6414
6407
|
}
|
|
6415
6408
|
return [4 /*yield*/, userInternal.auth._persistUserIfCurrent(userInternal)];
|
|
@@ -6432,10 +6425,11 @@ function _link(user, credential, bypassAuthState) {
|
|
|
6432
6425
|
_d = (_c = credential)._linkToIdToken;
|
|
6433
6426
|
_e = [user.auth];
|
|
6434
6427
|
return [4 /*yield*/, user.getIdToken()];
|
|
6435
|
-
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
6428
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
6429
|
+
bypassAuthState]))];
|
|
6436
6430
|
case 2:
|
|
6437
6431
|
response = _f.sent();
|
|
6438
|
-
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* LINK */, response)];
|
|
6432
|
+
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response)];
|
|
6439
6433
|
}
|
|
6440
6434
|
});
|
|
6441
6435
|
});
|
|
@@ -6450,8 +6444,8 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
6450
6444
|
_a.sent();
|
|
6451
6445
|
providerIds = providerDataAsNames(user.providerData);
|
|
6452
6446
|
code = expected === false
|
|
6453
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
6454
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
6447
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
6448
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
6455
6449
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
6456
6450
|
return [2 /*return*/];
|
|
6457
6451
|
}
|
|
@@ -6476,32 +6470,31 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
6476
6470
|
* limitations under the License.
|
|
6477
6471
|
*/
|
|
6478
6472
|
function _reauthenticate(user, credential, bypassAuthState) {
|
|
6479
|
-
var _a;
|
|
6480
6473
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
6481
6474
|
return __awaiter(this, void 0, void 0, function () {
|
|
6482
6475
|
var auth, operationType, response, parsed, localId, e_1;
|
|
6483
|
-
return __generator(this, function (
|
|
6484
|
-
switch (
|
|
6476
|
+
return __generator(this, function (_a) {
|
|
6477
|
+
switch (_a.label) {
|
|
6485
6478
|
case 0:
|
|
6486
6479
|
auth = user.auth;
|
|
6487
|
-
operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
6488
|
-
|
|
6480
|
+
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
6481
|
+
_a.label = 1;
|
|
6489
6482
|
case 1:
|
|
6490
|
-
|
|
6483
|
+
_a.trys.push([1, 3, , 4]);
|
|
6491
6484
|
return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
|
|
6492
6485
|
case 2:
|
|
6493
|
-
response =
|
|
6494
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6486
|
+
response = _a.sent();
|
|
6487
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6495
6488
|
parsed = _parseToken(response.idToken);
|
|
6496
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6489
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6497
6490
|
localId = parsed.sub;
|
|
6498
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
6491
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
6499
6492
|
return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
|
|
6500
6493
|
case 3:
|
|
6501
|
-
e_1 =
|
|
6494
|
+
e_1 = _a.sent();
|
|
6502
6495
|
// Convert user deleted error into user mismatch
|
|
6503
|
-
if ((
|
|
6504
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
6496
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/".concat("user-not-found" /* AuthErrorCode.USER_DELETED */)) {
|
|
6497
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
6505
6498
|
}
|
|
6506
6499
|
throw e_1;
|
|
6507
6500
|
case 4: return [2 /*return*/];
|
|
@@ -6533,7 +6526,7 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6533
6526
|
return __generator(this, function (_a) {
|
|
6534
6527
|
switch (_a.label) {
|
|
6535
6528
|
case 0:
|
|
6536
|
-
operationType = "signIn" /* SIGN_IN */;
|
|
6529
|
+
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
6537
6530
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
6538
6531
|
case 1:
|
|
6539
6532
|
response = _a.sent();
|
|
@@ -6633,7 +6626,7 @@ function reauthenticateWithCredential(user, credential) {
|
|
|
6633
6626
|
function signInWithCustomToken$1(auth, request) {
|
|
6634
6627
|
return __awaiter(this, void 0, void 0, function () {
|
|
6635
6628
|
return __generator(this, function (_a) {
|
|
6636
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
6629
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
6637
6630
|
});
|
|
6638
6631
|
});
|
|
6639
6632
|
}
|
|
@@ -6683,7 +6676,7 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
6683
6676
|
})];
|
|
6684
6677
|
case 1:
|
|
6685
6678
|
response = _a.sent();
|
|
6686
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
6679
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
6687
6680
|
case 2:
|
|
6688
6681
|
cred = _a.sent();
|
|
6689
6682
|
return [4 /*yield*/, authInternal._updateCurrentUser(cred.user)];
|
|
@@ -6722,14 +6715,14 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
6722
6715
|
if ('phoneInfo' in enrollment) {
|
|
6723
6716
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
6724
6717
|
}
|
|
6725
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6718
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6726
6719
|
};
|
|
6727
6720
|
return MultiFactorInfoImpl;
|
|
6728
6721
|
}());
|
|
6729
6722
|
var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
6730
6723
|
__extends(PhoneMultiFactorInfoImpl, _super);
|
|
6731
6724
|
function PhoneMultiFactorInfoImpl(response) {
|
|
6732
|
-
var _this = _super.call(this, "phone" /* PHONE */, response) || this;
|
|
6725
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */, response) || this;
|
|
6733
6726
|
_this.phoneNumber = response.phoneInfo;
|
|
6734
6727
|
return _this;
|
|
6735
6728
|
}
|
|
@@ -6757,18 +6750,18 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
6757
6750
|
*/
|
|
6758
6751
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
6759
6752
|
var _a;
|
|
6760
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
6753
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
6761
6754
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
6762
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
6755
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
6763
6756
|
request.continueUrl = actionCodeSettings.url;
|
|
6764
6757
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
6765
6758
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
6766
6759
|
if (actionCodeSettings.iOS) {
|
|
6767
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
6760
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
6768
6761
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
6769
6762
|
}
|
|
6770
6763
|
if (actionCodeSettings.android) {
|
|
6771
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
6764
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
6772
6765
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
6773
6766
|
request.androidMinimumVersionCode =
|
|
6774
6767
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -6832,7 +6825,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
6832
6825
|
case 0:
|
|
6833
6826
|
authModular = getModularInstance(auth);
|
|
6834
6827
|
request = {
|
|
6835
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
6828
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
6836
6829
|
email: email
|
|
6837
6830
|
};
|
|
6838
6831
|
if (actionCodeSettings) {
|
|
@@ -6911,18 +6904,18 @@ function checkActionCode(auth, oobCode) {
|
|
|
6911
6904
|
case 1:
|
|
6912
6905
|
response = _a.sent();
|
|
6913
6906
|
operation = response.requestType;
|
|
6914
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6907
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6915
6908
|
switch (operation) {
|
|
6916
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
6909
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
6917
6910
|
break;
|
|
6918
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
6919
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6911
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
6912
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6920
6913
|
break;
|
|
6921
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
6922
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6914
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
6915
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6923
6916
|
// fall through
|
|
6924
6917
|
default:
|
|
6925
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6918
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6926
6919
|
}
|
|
6927
6920
|
multiFactorInfo = null;
|
|
6928
6921
|
if (response.mfaInfo) {
|
|
@@ -6930,10 +6923,10 @@ function checkActionCode(auth, oobCode) {
|
|
|
6930
6923
|
}
|
|
6931
6924
|
return [2 /*return*/, {
|
|
6932
6925
|
data: {
|
|
6933
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
6926
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
6934
6927
|
? response.newEmail
|
|
6935
6928
|
: response.email) || null,
|
|
6936
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
6929
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
6937
6930
|
? response.email
|
|
6938
6931
|
: response.newEmail) || null,
|
|
6939
6932
|
multiFactorInfo: multiFactorInfo
|
|
@@ -6999,7 +6992,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6999
6992
|
})];
|
|
7000
6993
|
case 1:
|
|
7001
6994
|
response = _a.sent();
|
|
7002
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
6995
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
7003
6996
|
case 2:
|
|
7004
6997
|
userCredential = _a.sent();
|
|
7005
6998
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -7092,10 +7085,10 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
7092
7085
|
case 0:
|
|
7093
7086
|
authModular = getModularInstance(auth);
|
|
7094
7087
|
request = {
|
|
7095
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
7088
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
7096
7089
|
email: email
|
|
7097
7090
|
};
|
|
7098
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
7091
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7099
7092
|
if (actionCodeSettings) {
|
|
7100
7093
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
7101
7094
|
}
|
|
@@ -7117,7 +7110,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
7117
7110
|
*/
|
|
7118
7111
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
7119
7112
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
7120
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
7113
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
7121
7114
|
}
|
|
7122
7115
|
/**
|
|
7123
7116
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -7164,7 +7157,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
7164
7157
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
7165
7158
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
7166
7159
|
// instance.
|
|
7167
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
7160
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
7168
7161
|
return [2 /*return*/, signInWithCredential(authModular, credential)];
|
|
7169
7162
|
});
|
|
7170
7163
|
});
|
|
@@ -7189,7 +7182,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
7189
7182
|
function createAuthUri(auth, request) {
|
|
7190
7183
|
return __awaiter(this, void 0, void 0, function () {
|
|
7191
7184
|
return __generator(this, function (_a) {
|
|
7192
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
7185
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
7193
7186
|
});
|
|
7194
7187
|
});
|
|
7195
7188
|
}
|
|
@@ -7284,7 +7277,7 @@ function sendEmailVerification(user, actionCodeSettings) {
|
|
|
7284
7277
|
case 1:
|
|
7285
7278
|
idToken = _a.sent();
|
|
7286
7279
|
request = {
|
|
7287
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
7280
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
7288
7281
|
idToken: idToken
|
|
7289
7282
|
};
|
|
7290
7283
|
if (actionCodeSettings) {
|
|
@@ -7348,7 +7341,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
7348
7341
|
case 1:
|
|
7349
7342
|
idToken = _a.sent();
|
|
7350
7343
|
request = {
|
|
7351
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
7344
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
7352
7345
|
idToken: idToken,
|
|
7353
7346
|
newEmail: newEmail
|
|
7354
7347
|
};
|
|
@@ -7392,7 +7385,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
7392
7385
|
function updateProfile$1(auth, request) {
|
|
7393
7386
|
return __awaiter(this, void 0, void 0, function () {
|
|
7394
7387
|
return __generator(this, function (_a) {
|
|
7395
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
7388
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
7396
7389
|
});
|
|
7397
7390
|
});
|
|
7398
7391
|
}
|
|
@@ -7448,7 +7441,7 @@ function updateProfile(user, _a) {
|
|
|
7448
7441
|
userInternal.photoURL = response.photoUrl || null;
|
|
7449
7442
|
passwordProvider = userInternal.providerData.find(function (_a) {
|
|
7450
7443
|
var providerId = _a.providerId;
|
|
7451
|
-
return providerId === "password" /* PASSWORD */;
|
|
7444
|
+
return providerId === "password" /* ProviderId.PASSWORD */;
|
|
7452
7445
|
});
|
|
7453
7446
|
if (passwordProvider) {
|
|
7454
7447
|
passwordProvider.displayName = userInternal.displayName;
|
|
@@ -7559,12 +7552,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
7559
7552
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
7560
7553
|
: {};
|
|
7561
7554
|
var isNewUser = idTokenResponse.isNewUser ||
|
|
7562
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
7555
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
7563
7556
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
7564
7557
|
var signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];
|
|
7565
7558
|
if (signInProvider) {
|
|
7566
|
-
var filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
7567
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
7559
|
+
var filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
7560
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
7568
7561
|
? signInProvider
|
|
7569
7562
|
: null;
|
|
7570
7563
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -7575,16 +7568,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
7575
7568
|
return null;
|
|
7576
7569
|
}
|
|
7577
7570
|
switch (providerId) {
|
|
7578
|
-
case "facebook.com" /* FACEBOOK */:
|
|
7571
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
7579
7572
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
7580
|
-
case "github.com" /* GITHUB */:
|
|
7573
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
7581
7574
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
7582
|
-
case "google.com" /* GOOGLE */:
|
|
7575
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
7583
7576
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
7584
|
-
case "twitter.com" /* TWITTER */:
|
|
7577
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
7585
7578
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
7586
|
-
case "custom" /* CUSTOM */:
|
|
7587
|
-
case "anonymous" /* ANONYMOUS */:
|
|
7579
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
7580
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
7588
7581
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
7589
7582
|
default:
|
|
7590
7583
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -7611,28 +7604,28 @@ var FederatedAdditionalUserInfoWithUsername = /** @class */ (function (_super) {
|
|
|
7611
7604
|
var FacebookAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7612
7605
|
__extends(FacebookAdditionalUserInfo, _super);
|
|
7613
7606
|
function FacebookAdditionalUserInfo(isNewUser, profile) {
|
|
7614
|
-
return _super.call(this, isNewUser, "facebook.com" /* FACEBOOK */, profile) || this;
|
|
7607
|
+
return _super.call(this, isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile) || this;
|
|
7615
7608
|
}
|
|
7616
7609
|
return FacebookAdditionalUserInfo;
|
|
7617
7610
|
}(GenericAdditionalUserInfo));
|
|
7618
7611
|
var GithubAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7619
7612
|
__extends(GithubAdditionalUserInfo, _super);
|
|
7620
7613
|
function GithubAdditionalUserInfo(isNewUser, profile) {
|
|
7621
|
-
return _super.call(this, isNewUser, "github.com" /* GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
7614
|
+
return _super.call(this, isNewUser, "github.com" /* ProviderId.GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
7622
7615
|
}
|
|
7623
7616
|
return GithubAdditionalUserInfo;
|
|
7624
7617
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
7625
7618
|
var GoogleAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7626
7619
|
__extends(GoogleAdditionalUserInfo, _super);
|
|
7627
7620
|
function GoogleAdditionalUserInfo(isNewUser, profile) {
|
|
7628
|
-
return _super.call(this, isNewUser, "google.com" /* GOOGLE */, profile) || this;
|
|
7621
|
+
return _super.call(this, isNewUser, "google.com" /* ProviderId.GOOGLE */, profile) || this;
|
|
7629
7622
|
}
|
|
7630
7623
|
return GoogleAdditionalUserInfo;
|
|
7631
7624
|
}(GenericAdditionalUserInfo));
|
|
7632
7625
|
var TwitterAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7633
7626
|
__extends(TwitterAdditionalUserInfo, _super);
|
|
7634
7627
|
function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {
|
|
7635
|
-
return _super.call(this, isNewUser, "twitter.com" /* TWITTER */, profile, screenName) || this;
|
|
7628
|
+
return _super.call(this, isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName) || this;
|
|
7636
7629
|
}
|
|
7637
7630
|
return TwitterAdditionalUserInfo;
|
|
7638
7631
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
@@ -7815,14 +7808,14 @@ var MultiFactorSessionImpl = /** @class */ (function () {
|
|
|
7815
7808
|
this.auth = auth;
|
|
7816
7809
|
}
|
|
7817
7810
|
MultiFactorSessionImpl._fromIdtoken = function (idToken, auth) {
|
|
7818
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
7811
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
7819
7812
|
};
|
|
7820
7813
|
MultiFactorSessionImpl._fromMfaPendingCredential = function (mfaPendingCredential) {
|
|
7821
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
7814
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
7822
7815
|
};
|
|
7823
7816
|
MultiFactorSessionImpl.prototype.toJSON = function () {
|
|
7824
7817
|
var _a;
|
|
7825
|
-
var key = this.type === "enroll" /* ENROLL */
|
|
7818
|
+
var key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
7826
7819
|
? 'idToken'
|
|
7827
7820
|
: 'pendingCredential';
|
|
7828
7821
|
return {
|
|
@@ -7876,7 +7869,7 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7876
7869
|
var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
|
|
7877
7870
|
return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
7878
7871
|
});
|
|
7879
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7872
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7880
7873
|
var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
7881
7874
|
return new MultiFactorResolverImpl(session, hints, function (assertion) { return __awaiter(_this, void 0, void 0, function () {
|
|
7882
7875
|
var mfaResponse, idTokenResponse, _a, userCredential;
|
|
@@ -7891,8 +7884,8 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7891
7884
|
idTokenResponse = __assign(__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
7892
7885
|
_a = error.operationType;
|
|
7893
7886
|
switch (_a) {
|
|
7894
|
-
case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
|
|
7895
|
-
case "reauthenticate" /* REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
7887
|
+
case "signIn" /* OperationType.SIGN_IN */: return [3 /*break*/, 2];
|
|
7888
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
7896
7889
|
}
|
|
7897
7890
|
return [3 /*break*/, 6];
|
|
7898
7891
|
case 2: return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse)];
|
|
@@ -7903,10 +7896,10 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7903
7896
|
_b.sent();
|
|
7904
7897
|
return [2 /*return*/, userCredential];
|
|
7905
7898
|
case 5:
|
|
7906
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7899
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7907
7900
|
return [2 /*return*/, UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse)];
|
|
7908
7901
|
case 6:
|
|
7909
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7902
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7910
7903
|
_b.label = 7;
|
|
7911
7904
|
case 7: return [2 /*return*/];
|
|
7912
7905
|
}
|
|
@@ -7938,8 +7931,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
7938
7931
|
var _a;
|
|
7939
7932
|
var authModular = getModularInstance(auth);
|
|
7940
7933
|
var errorInternal = error;
|
|
7941
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
7942
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
7934
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7935
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7943
7936
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
7944
7937
|
}
|
|
7945
7938
|
|
|
@@ -7960,7 +7953,7 @@ function getMultiFactorResolver(auth, error) {
|
|
|
7960
7953
|
* limitations under the License.
|
|
7961
7954
|
*/
|
|
7962
7955
|
function withdrawMfa(auth, request) {
|
|
7963
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
7956
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
7964
7957
|
}
|
|
7965
7958
|
|
|
7966
7959
|
var MultiFactorUserImpl = /** @class */ (function () {
|
|
@@ -8021,22 +8014,21 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
8021
8014
|
});
|
|
8022
8015
|
};
|
|
8023
8016
|
MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
|
|
8024
|
-
var _a;
|
|
8025
8017
|
return __awaiter(this, void 0, void 0, function () {
|
|
8026
8018
|
var mfaEnrollmentId, idToken, idTokenResponse, e_1;
|
|
8027
|
-
return __generator(this, function (
|
|
8028
|
-
switch (
|
|
8019
|
+
return __generator(this, function (_a) {
|
|
8020
|
+
switch (_a.label) {
|
|
8029
8021
|
case 0:
|
|
8030
8022
|
mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
8031
8023
|
return [4 /*yield*/, this.user.getIdToken()];
|
|
8032
8024
|
case 1:
|
|
8033
|
-
idToken =
|
|
8025
|
+
idToken = _a.sent();
|
|
8034
8026
|
return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
8035
8027
|
idToken: idToken,
|
|
8036
8028
|
mfaEnrollmentId: mfaEnrollmentId
|
|
8037
8029
|
}))];
|
|
8038
8030
|
case 2:
|
|
8039
|
-
idTokenResponse =
|
|
8031
|
+
idTokenResponse = _a.sent();
|
|
8040
8032
|
// Remove the second factor from the user's list.
|
|
8041
8033
|
this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
|
|
8042
8034
|
var uid = _a.uid;
|
|
@@ -8052,17 +8044,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
8052
8044
|
// the tokenResponse may be empty. If the tokens were not updated (and they
|
|
8053
8045
|
// are now invalid), reloading the user will discover this and invalidate
|
|
8054
8046
|
// the user's state accordingly.
|
|
8055
|
-
|
|
8056
|
-
|
|
8047
|
+
_a.sent();
|
|
8048
|
+
_a.label = 4;
|
|
8057
8049
|
case 4:
|
|
8058
|
-
|
|
8050
|
+
_a.trys.push([4, 6, , 7]);
|
|
8059
8051
|
return [4 /*yield*/, this.user.reload()];
|
|
8060
8052
|
case 5:
|
|
8061
|
-
|
|
8053
|
+
_a.sent();
|
|
8062
8054
|
return [3 /*break*/, 7];
|
|
8063
8055
|
case 6:
|
|
8064
|
-
e_1 =
|
|
8065
|
-
if ((
|
|
8056
|
+
e_1 = _a.sent();
|
|
8057
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
|
|
8066
8058
|
throw e_1;
|
|
8067
8059
|
}
|
|
8068
8060
|
return [3 /*break*/, 7];
|
|
@@ -8108,12 +8100,12 @@ function multiFactor(user) {
|
|
|
8108
8100
|
* See the License for the specific language governing permissions and
|
|
8109
8101
|
* limitations under the License.
|
|
8110
8102
|
*/
|
|
8111
|
-
registerAuth("Worker" /* WORKER */);
|
|
8103
|
+
registerAuth("Worker" /* ClientPlatform.WORKER */);
|
|
8112
8104
|
function getAuth(app) {
|
|
8113
8105
|
if (app === void 0) { app = getApp(); }
|
|
8114
8106
|
// Unlike the other environments, we need to explicitly check if indexedDb is
|
|
8115
8107
|
// available. That means doing the whole rigamarole
|
|
8116
|
-
var auth = _getProvider(app, "auth" /* AUTH */).getImmediate();
|
|
8108
|
+
var auth = _getProvider(app, "auth" /* _ComponentName.AUTH */).getImmediate();
|
|
8117
8109
|
// This promise is intended to float; auth initialization happens in the
|
|
8118
8110
|
// background, meanwhile the auth object may be used by the app.
|
|
8119
8111
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|