@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
|
@@ -120,147 +120,147 @@ const ActionCodeOperation = {
|
|
|
120
120
|
*/
|
|
121
121
|
function _debugErrorMap() {
|
|
122
122
|
return {
|
|
123
|
-
["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.',
|
|
124
|
-
["argument-error" /* ARGUMENT_ERROR */]: '',
|
|
125
|
-
["app-not-authorized" /* APP_NOT_AUTHORIZED */]: "This app, identified by the domain where it's hosted, is not " +
|
|
123
|
+
["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.',
|
|
124
|
+
["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */]: '',
|
|
125
|
+
["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */]: "This app, identified by the domain where it's hosted, is not " +
|
|
126
126
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
127
127
|
'Review your key configuration in the Google API console.',
|
|
128
|
-
["app-not-installed" /* APP_NOT_INSTALLED */]: 'The requested mobile application corresponding to the identifier (' +
|
|
128
|
+
["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */]: 'The requested mobile application corresponding to the identifier (' +
|
|
129
129
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
130
130
|
'this device.',
|
|
131
|
-
["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */]: 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
131
|
+
["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */]: 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
132
132
|
'already used or the domain associated with it does not match the list ' +
|
|
133
133
|
'of whitelisted domains.',
|
|
134
|
-
["code-expired" /* CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
134
|
+
["code-expired" /* AuthErrorCode.CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
135
135
|
'again.',
|
|
136
|
-
["cordova-not-ready" /* CORDOVA_NOT_READY */]: 'Cordova framework is not ready.',
|
|
137
|
-
["cors-unsupported" /* CORS_UNSUPPORTED */]: 'This browser is not supported.',
|
|
138
|
-
["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.',
|
|
139
|
-
["custom-token-mismatch" /* CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.',
|
|
140
|
-
["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
136
|
+
["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */]: 'Cordova framework is not ready.',
|
|
137
|
+
["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */]: 'This browser is not supported.',
|
|
138
|
+
["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.',
|
|
139
|
+
["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.',
|
|
140
|
+
["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
141
141
|
'again before retrying this request.',
|
|
142
|
-
["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
142
|
+
["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 ' +
|
|
143
143
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
144
144
|
'starting any other Firebase SDK.',
|
|
145
|
-
["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
145
|
+
["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
146
146
|
'conditions.',
|
|
147
|
-
["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.',
|
|
148
|
-
["email-already-in-use" /* EMAIL_EXISTS */]: 'The email address is already in use by another account.',
|
|
149
|
-
["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */]: 'Auth instance has already been used to make a network call. Auth can ' +
|
|
147
|
+
["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.',
|
|
148
|
+
["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */]: 'The email address is already in use by another account.',
|
|
149
|
+
["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */]: 'Auth instance has already been used to make a network call. Auth can ' +
|
|
150
150
|
'no longer be configured to use the emulator. Try calling ' +
|
|
151
151
|
'"connectAuthEmulator()" sooner.',
|
|
152
|
-
["expired-action-code" /* EXPIRED_OOB_CODE */]: 'The action code has expired.',
|
|
153
|
-
["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
154
|
-
["internal-error" /* INTERNAL_ERROR */]: 'An internal AuthError has occurred.',
|
|
155
|
-
["invalid-app-credential" /* INVALID_APP_CREDENTIAL */]: 'The phone verification request contains an invalid application verifier.' +
|
|
152
|
+
["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */]: 'The action code has expired.',
|
|
153
|
+
["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
154
|
+
["internal-error" /* AuthErrorCode.INTERNAL_ERROR */]: 'An internal AuthError has occurred.',
|
|
155
|
+
["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */]: 'The phone verification request contains an invalid application verifier.' +
|
|
156
156
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
157
|
-
["invalid-app-id" /* INVALID_APP_ID */]: 'The mobile app identifier is not registed for the current project.',
|
|
158
|
-
["invalid-user-token" /* INVALID_AUTH */]: "This user's credential isn't valid for this project. This can happen " +
|
|
157
|
+
["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */]: 'The mobile app identifier is not registed for the current project.',
|
|
158
|
+
["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */]: "This user's credential isn't valid for this project. This can happen " +
|
|
159
159
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
160
160
|
'the project associated with this API key.',
|
|
161
|
-
["invalid-auth-event" /* INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
162
|
-
["invalid-verification-code" /* INVALID_CODE */]: 'The SMS verification code used to create the phone auth credential is ' +
|
|
161
|
+
["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
162
|
+
["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */]: 'The SMS verification code used to create the phone auth credential is ' +
|
|
163
163
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
164
164
|
'verification code provided by the user.',
|
|
165
|
-
["invalid-continue-uri" /* INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.',
|
|
166
|
-
["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
165
|
+
["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.',
|
|
166
|
+
["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
167
167
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
168
168
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
169
169
|
'cordova-plugin-customurlscheme.',
|
|
170
|
-
["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.',
|
|
171
|
-
["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
172
|
-
["invalid-email" /* INVALID_EMAIL */]: 'The email address is badly formatted.',
|
|
173
|
-
["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
174
|
-
["invalid-api-key" /* INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',
|
|
175
|
-
["invalid-cert-hash" /* INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',
|
|
176
|
-
["invalid-credential" /* INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',
|
|
177
|
-
["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
170
|
+
["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.',
|
|
171
|
+
["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
172
|
+
["invalid-email" /* AuthErrorCode.INVALID_EMAIL */]: 'The email address is badly formatted.',
|
|
173
|
+
["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
174
|
+
["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',
|
|
175
|
+
["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',
|
|
176
|
+
["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',
|
|
177
|
+
["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
178
178
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
179
|
-
["invalid-multi-factor-session" /* INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
180
|
-
["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
179
|
+
["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
180
|
+
["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
181
181
|
'only supports OAuth providers.',
|
|
182
|
-
["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */]: 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
182
|
+
["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */]: 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
183
183
|
'specified API key.',
|
|
184
|
-
["unauthorized-domain" /* INVALID_ORIGIN */]: 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
184
|
+
["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */]: 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
185
185
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
186
|
-
["invalid-action-code" /* INVALID_OOB_CODE */]: 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
186
|
+
["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */]: 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
187
187
|
'expired, or has already been used.',
|
|
188
|
-
["wrong-password" /* INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.',
|
|
189
|
-
["invalid-persistence-type" /* INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
190
|
-
["invalid-phone-number" /* INVALID_PHONE_NUMBER */]: 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
188
|
+
["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.',
|
|
189
|
+
["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
190
|
+
["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */]: 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
191
191
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
192
192
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
193
193
|
'number including area code].',
|
|
194
|
-
["invalid-provider-id" /* INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.',
|
|
195
|
-
["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */]: 'The email corresponding to this action failed to send as the provided ' +
|
|
194
|
+
["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.',
|
|
195
|
+
["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */]: 'The email corresponding to this action failed to send as the provided ' +
|
|
196
196
|
'recipient email address is invalid.',
|
|
197
|
-
["invalid-sender" /* INVALID_SENDER */]: 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
197
|
+
["invalid-sender" /* AuthErrorCode.INVALID_SENDER */]: 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
198
198
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
199
|
-
["invalid-verification-id" /* INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.',
|
|
200
|
-
["invalid-tenant-id" /* INVALID_TENANT_ID */]: "The Auth instance's tenant ID is invalid.",
|
|
201
|
-
["login-blocked" /* LOGIN_BLOCKED */]: 'Login blocked by user-provided method: {$originalMessage}',
|
|
202
|
-
["missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */]: 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
203
|
-
["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
199
|
+
["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.',
|
|
200
|
+
["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */]: "The Auth instance's tenant ID is invalid.",
|
|
201
|
+
["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */]: 'Login blocked by user-provided method: {$originalMessage}',
|
|
202
|
+
["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.',
|
|
203
|
+
["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
204
204
|
'by following the instructions in the Firebase console.',
|
|
205
|
-
["missing-app-credential" /* MISSING_APP_CREDENTIAL */]: 'The phone verification request is missing an application verifier ' +
|
|
205
|
+
["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */]: 'The phone verification request is missing an application verifier ' +
|
|
206
206
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
207
|
-
["missing-verification-code" /* MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.',
|
|
208
|
-
["missing-continue-uri" /* MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.',
|
|
209
|
-
["missing-iframe-start" /* MISSING_IFRAME_START */]: 'An internal AuthError has occurred.',
|
|
210
|
-
["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
211
|
-
["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' +
|
|
207
|
+
["missing-verification-code" /* AuthErrorCode.MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.',
|
|
208
|
+
["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.',
|
|
209
|
+
["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */]: 'An internal AuthError has occurred.',
|
|
210
|
+
["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
211
|
+
["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' +
|
|
212
212
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
213
213
|
'in the ID token payload.',
|
|
214
|
-
["missing-multi-factor-info" /* MISSING_MFA_INFO */]: 'No second factor identifier is provided.',
|
|
215
|
-
["missing-multi-factor-session" /* MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',
|
|
216
|
-
["missing-phone-number" /* MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',
|
|
217
|
-
["missing-verification-id" /* MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.',
|
|
218
|
-
["app-deleted" /* MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.',
|
|
219
|
-
["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.',
|
|
220
|
-
["multi-factor-auth-required" /* MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
221
|
-
["account-exists-with-different-credential" /* NEED_CONFIRMATION */]: 'An account already exists with the same email address but different ' +
|
|
214
|
+
["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */]: 'No second factor identifier is provided.',
|
|
215
|
+
["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',
|
|
216
|
+
["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',
|
|
217
|
+
["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.',
|
|
218
|
+
["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.',
|
|
219
|
+
["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.',
|
|
220
|
+
["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
221
|
+
["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */]: 'An account already exists with the same email address but different ' +
|
|
222
222
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
223
223
|
'email address.',
|
|
224
|
-
["network-request-failed" /* NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
225
|
-
["no-auth-event" /* NO_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
226
|
-
["no-such-provider" /* NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.',
|
|
227
|
-
["null-user" /* NULL_USER */]: 'A null user object was provided as the argument for an operation which ' +
|
|
224
|
+
["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
225
|
+
["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
226
|
+
["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.',
|
|
227
|
+
["null-user" /* AuthErrorCode.NULL_USER */]: 'A null user object was provided as the argument for an operation which ' +
|
|
228
228
|
'requires a non-null user object.',
|
|
229
|
-
["operation-not-allowed" /* OPERATION_NOT_ALLOWED */]: 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
229
|
+
["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */]: 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
230
230
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
231
231
|
'Auth section.',
|
|
232
|
-
["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */]: 'This operation is not supported in the environment this application is ' +
|
|
232
|
+
["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */]: 'This operation is not supported in the environment this application is ' +
|
|
233
233
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
234
234
|
' and web storage must be enabled.',
|
|
235
|
-
["popup-blocked" /* POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
236
|
-
["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.',
|
|
237
|
-
["provider-already-linked" /* PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.',
|
|
238
|
-
["quota-exceeded" /* QUOTA_EXCEEDED */]: "The project's quota for this operation has been exceeded.",
|
|
239
|
-
["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.',
|
|
240
|
-
["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.',
|
|
241
|
-
["rejected-credential" /* REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.',
|
|
242
|
-
["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.',
|
|
243
|
-
["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
244
|
-
["tenant-id-mismatch" /* TENANT_ID_MISMATCH */]: "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
245
|
-
["timeout" /* TIMEOUT */]: 'The operation has timed out.',
|
|
246
|
-
["user-token-expired" /* TOKEN_EXPIRED */]: "The user's credential is no longer valid. The user must sign in again.",
|
|
247
|
-
["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: 'We have blocked all requests from this device due to unusual activity. ' +
|
|
235
|
+
["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
236
|
+
["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.',
|
|
237
|
+
["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.',
|
|
238
|
+
["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */]: "The project's quota for this operation has been exceeded.",
|
|
239
|
+
["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.',
|
|
240
|
+
["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.',
|
|
241
|
+
["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.',
|
|
242
|
+
["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.',
|
|
243
|
+
["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
244
|
+
["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */]: "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
245
|
+
["timeout" /* AuthErrorCode.TIMEOUT */]: 'The operation has timed out.',
|
|
246
|
+
["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */]: "The user's credential is no longer valid. The user must sign in again.",
|
|
247
|
+
["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */]: 'We have blocked all requests from this device due to unusual activity. ' +
|
|
248
248
|
'Try again later.',
|
|
249
|
-
["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */]: 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
249
|
+
["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */]: 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
250
250
|
'the domain in the Firebase console.',
|
|
251
|
-
["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.',
|
|
252
|
-
["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.',
|
|
253
|
-
["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.',
|
|
254
|
-
["unverified-email" /* UNVERIFIED_EMAIL */]: 'The operation requires a verified email.',
|
|
255
|
-
["user-cancelled" /* USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.',
|
|
256
|
-
["user-not-found" /* USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' +
|
|
251
|
+
["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.',
|
|
252
|
+
["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.',
|
|
253
|
+
["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.',
|
|
254
|
+
["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */]: 'The operation requires a verified email.',
|
|
255
|
+
["user-cancelled" /* AuthErrorCode.USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.',
|
|
256
|
+
["user-not-found" /* AuthErrorCode.USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' +
|
|
257
257
|
'have been deleted.',
|
|
258
|
-
["user-disabled" /* USER_DISABLED */]: 'The user account has been disabled by an administrator.',
|
|
259
|
-
["user-mismatch" /* USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.',
|
|
260
|
-
["user-signed-out" /* USER_SIGNED_OUT */]: '',
|
|
261
|
-
["weak-password" /* WEAK_PASSWORD */]: 'The password must be 6 characters long or more.',
|
|
262
|
-
["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
263
|
-
["already-initialized" /* ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' +
|
|
258
|
+
["user-disabled" /* AuthErrorCode.USER_DISABLED */]: 'The user account has been disabled by an administrator.',
|
|
259
|
+
["user-mismatch" /* AuthErrorCode.USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.',
|
|
260
|
+
["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */]: '',
|
|
261
|
+
["weak-password" /* AuthErrorCode.WEAK_PASSWORD */]: 'The password must be 6 characters long or more.',
|
|
262
|
+
["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
263
|
+
["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' +
|
|
264
264
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
265
265
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
266
266
|
' already initialized instance.'
|
|
@@ -271,7 +271,7 @@ function _prodErrorMap() {
|
|
|
271
271
|
// nature of this error, developers will never be able to see the message
|
|
272
272
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
273
273
|
return {
|
|
274
|
-
["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
274
|
+
["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 ' +
|
|
275
275
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
276
276
|
'starting any other Firebase SDK.'
|
|
277
277
|
};
|
|
@@ -458,9 +458,9 @@ function _assertInstanceOf(auth, object, instance) {
|
|
|
458
458
|
const constructorInstance = instance;
|
|
459
459
|
if (!(object instanceof constructorInstance)) {
|
|
460
460
|
if (constructorInstance.name !== object.constructor.name) {
|
|
461
|
-
_fail(auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
461
|
+
_fail(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
462
462
|
}
|
|
463
|
-
throw _errorWithCustomMessage(auth, "argument-error" /* ARGUMENT_ERROR */, `Type of ${object.constructor.name} does not match expected instance.` +
|
|
463
|
+
throw _errorWithCustomMessage(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, `Type of ${object.constructor.name} does not match expected instance.` +
|
|
464
464
|
`Did you pass a reference from a different Auth SDK?`);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
@@ -588,7 +588,7 @@ function initializeAuth(app, deps) {
|
|
|
588
588
|
return auth;
|
|
589
589
|
}
|
|
590
590
|
else {
|
|
591
|
-
_fail(auth, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
591
|
+
_fail(auth, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
const auth = provider.initialize({ options: deps });
|
|
@@ -716,7 +716,7 @@ class Delay {
|
|
|
716
716
|
get() {
|
|
717
717
|
if (!_isOnline()) {
|
|
718
718
|
// Pick the shorter timeout.
|
|
719
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
719
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
720
720
|
}
|
|
721
721
|
// If running in a mobile environment, return the long delay, otherwise
|
|
722
722
|
// return the short delay.
|
|
@@ -827,64 +827,64 @@ class FetchProvider {
|
|
|
827
827
|
*/
|
|
828
828
|
const SERVER_ERROR_MAP = {
|
|
829
829
|
// Custom token errors.
|
|
830
|
-
["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */]: "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
830
|
+
["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */]: "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
831
831
|
// This can only happen if the SDK sends a bad request.
|
|
832
|
-
["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */]: "internal-error" /* INTERNAL_ERROR */,
|
|
832
|
+
["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
833
833
|
// Create Auth URI errors.
|
|
834
|
-
["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */]: "invalid-email" /* INVALID_EMAIL */,
|
|
834
|
+
["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */]: "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
835
835
|
// This can only happen if the SDK sends a bad request.
|
|
836
|
-
["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */]: "internal-error" /* INTERNAL_ERROR */,
|
|
836
|
+
["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
837
837
|
// Sign in with email and password errors (some apply to sign up too).
|
|
838
|
-
["INVALID_PASSWORD" /* INVALID_PASSWORD */]: "wrong-password" /* INVALID_PASSWORD */,
|
|
838
|
+
["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */]: "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
839
839
|
// This can only happen if the SDK sends a bad request.
|
|
840
|
-
["MISSING_PASSWORD" /* MISSING_PASSWORD */]: "internal-error" /* INTERNAL_ERROR */,
|
|
840
|
+
["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
841
841
|
// Sign up with email and password errors.
|
|
842
|
-
["EMAIL_EXISTS" /* EMAIL_EXISTS */]: "email-already-in-use" /* EMAIL_EXISTS */,
|
|
843
|
-
["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
842
|
+
["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */]: "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
843
|
+
["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
844
844
|
// Verify assertion for sign in with credential errors:
|
|
845
|
-
["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
846
|
-
["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
847
|
-
["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
845
|
+
["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
846
|
+
["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
847
|
+
["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
848
848
|
// This can only happen if the SDK sends a bad request.
|
|
849
|
-
["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */]: "internal-error" /* INTERNAL_ERROR */,
|
|
849
|
+
["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
850
850
|
// Send Password reset email errors:
|
|
851
|
-
["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */]: "user-not-found" /* USER_DELETED */,
|
|
852
|
-
["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */]: "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
853
|
-
["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */]: "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
854
|
-
["INVALID_OOB_CODE" /* INVALID_OOB_CODE */]: "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
851
|
+
["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
852
|
+
["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
853
|
+
["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */]: "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
854
|
+
["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */]: "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
855
855
|
// This can only happen if the SDK sends a bad request.
|
|
856
|
-
["MISSING_OOB_CODE" /* MISSING_OOB_CODE */]: "internal-error" /* INTERNAL_ERROR */,
|
|
856
|
+
["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
857
857
|
// Operations that require ID token in request:
|
|
858
|
-
["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
859
|
-
["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */]: "invalid-user-token" /* INVALID_AUTH */,
|
|
860
|
-
["TOKEN_EXPIRED" /* TOKEN_EXPIRED */]: "user-token-expired" /* TOKEN_EXPIRED */,
|
|
861
|
-
["USER_NOT_FOUND" /* USER_NOT_FOUND */]: "user-token-expired" /* TOKEN_EXPIRED */,
|
|
858
|
+
["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
859
|
+
["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */]: "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
860
|
+
["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
861
|
+
["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
862
862
|
// Other errors.
|
|
863
|
-
["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
863
|
+
["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
864
864
|
// Phone Auth related errors.
|
|
865
|
-
["INVALID_CODE" /* INVALID_CODE */]: "invalid-verification-code" /* INVALID_CODE */,
|
|
866
|
-
["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */]: "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
867
|
-
["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
868
|
-
["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */]: "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
869
|
-
["SESSION_EXPIRED" /* SESSION_EXPIRED */]: "code-expired" /* CODE_EXPIRED */,
|
|
865
|
+
["INVALID_CODE" /* ServerError.INVALID_CODE */]: "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
866
|
+
["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */]: "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
867
|
+
["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
868
|
+
["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */]: "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
869
|
+
["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */]: "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
870
870
|
// Other action code errors when additional settings passed.
|
|
871
871
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
872
872
|
// This is OK as this error will be caught by client side validation.
|
|
873
|
-
["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */]: "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
874
|
-
["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */]: "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
873
|
+
["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */]: "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
874
|
+
["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */]: "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
875
875
|
// getProjectConfig errors when clientId is passed.
|
|
876
|
-
["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */]: "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
876
|
+
["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */]: "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
877
877
|
// User actions (sign-up or deletion) disabled errors.
|
|
878
|
-
["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */]: "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
878
|
+
["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */]: "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
879
879
|
// Multi factor related errors.
|
|
880
|
-
["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */]: "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
881
|
-
["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */]: "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
882
|
-
["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */]: "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
883
|
-
["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */]: "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
884
|
-
["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
885
|
-
["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
880
|
+
["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */]: "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
881
|
+
["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */]: "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
882
|
+
["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */]: "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
883
|
+
["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */]: "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
884
|
+
["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
885
|
+
["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
886
886
|
// Blocking functions related errors.
|
|
887
|
-
["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* INTERNAL_ERROR */
|
|
887
|
+
["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */
|
|
888
888
|
};
|
|
889
889
|
|
|
890
890
|
/**
|
|
@@ -915,7 +915,7 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
915
915
|
let body = {};
|
|
916
916
|
let params = {};
|
|
917
917
|
if (request) {
|
|
918
|
-
if (method === "GET" /* GET */) {
|
|
918
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
919
919
|
params = request;
|
|
920
920
|
}
|
|
921
921
|
else {
|
|
@@ -926,9 +926,9 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
926
926
|
}
|
|
927
927
|
const query = querystring(Object.assign({ key: auth.config.apiKey }, params)).slice(1);
|
|
928
928
|
const headers = await auth._getAdditionalHeaders();
|
|
929
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
929
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
930
930
|
if (auth.languageCode) {
|
|
931
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
931
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
932
932
|
}
|
|
933
933
|
return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), Object.assign({ method,
|
|
934
934
|
headers, referrerPolicy: 'no-referrer' }, body));
|
|
@@ -948,7 +948,7 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
948
948
|
networkTimeout.clearNetworkTimeout();
|
|
949
949
|
const json = await response.json();
|
|
950
950
|
if ('needConfirmation' in json) {
|
|
951
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
951
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
952
952
|
}
|
|
953
953
|
if (response.ok && !('errorMessage' in json)) {
|
|
954
954
|
return json;
|
|
@@ -956,14 +956,14 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
956
956
|
else {
|
|
957
957
|
const errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
958
958
|
const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : ');
|
|
959
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
960
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
959
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
960
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
961
961
|
}
|
|
962
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
963
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
962
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
963
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
964
964
|
}
|
|
965
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
966
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
965
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
966
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
967
967
|
}
|
|
968
968
|
const authError = errorMap[serverErrorCode] ||
|
|
969
969
|
serverErrorCode
|
|
@@ -981,13 +981,13 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
981
981
|
if (e instanceof FirebaseError) {
|
|
982
982
|
throw e;
|
|
983
983
|
}
|
|
984
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
984
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
987
|
async function _performSignInRequest(auth, method, path, request, customErrorMap = {}) {
|
|
988
988
|
const serverResponse = (await _performApiRequest(auth, method, path, request, customErrorMap));
|
|
989
989
|
if ('mfaPendingCredential' in serverResponse) {
|
|
990
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
990
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
991
991
|
_serverResponse: serverResponse
|
|
992
992
|
});
|
|
993
993
|
}
|
|
@@ -1009,7 +1009,7 @@ class NetworkTimeout {
|
|
|
1009
1009
|
this.timer = null;
|
|
1010
1010
|
this.promise = new Promise((_, reject) => {
|
|
1011
1011
|
this.timer = setTimeout(() => {
|
|
1012
|
-
return reject(_createError(this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1012
|
+
return reject(_createError(this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1013
1013
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1014
1014
|
});
|
|
1015
1015
|
}
|
|
@@ -1050,13 +1050,13 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1050
1050
|
* limitations under the License.
|
|
1051
1051
|
*/
|
|
1052
1052
|
async function deleteAccount(auth, request) {
|
|
1053
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request);
|
|
1053
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request);
|
|
1054
1054
|
}
|
|
1055
1055
|
async function deleteLinkedAccounts(auth, request) {
|
|
1056
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
1056
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
1057
1057
|
}
|
|
1058
1058
|
async function getAccountInfo(auth, request) {
|
|
1059
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request);
|
|
1059
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request);
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
/**
|
|
@@ -1141,7 +1141,7 @@ async function getIdTokenResult(user, forceRefresh = false) {
|
|
|
1141
1141
|
const userInternal = getModularInstance(user);
|
|
1142
1142
|
const token = await userInternal.getIdToken(forceRefresh);
|
|
1143
1143
|
const claims = _parseToken(token);
|
|
1144
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1144
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1145
1145
|
const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1146
1146
|
const signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1147
1147
|
return {
|
|
@@ -1158,7 +1158,6 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1158
1158
|
return Number(seconds) * 1000;
|
|
1159
1159
|
}
|
|
1160
1160
|
function _parseToken(token) {
|
|
1161
|
-
var _a;
|
|
1162
1161
|
const [algorithm, payload, signature] = token.split('.');
|
|
1163
1162
|
if (algorithm === undefined ||
|
|
1164
1163
|
payload === undefined ||
|
|
@@ -1175,7 +1174,7 @@ function _parseToken(token) {
|
|
|
1175
1174
|
return JSON.parse(decoded);
|
|
1176
1175
|
}
|
|
1177
1176
|
catch (e) {
|
|
1178
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1177
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1179
1178
|
return null;
|
|
1180
1179
|
}
|
|
1181
1180
|
}
|
|
@@ -1184,9 +1183,9 @@ function _parseToken(token) {
|
|
|
1184
1183
|
*/
|
|
1185
1184
|
function _tokenExpiresIn(token) {
|
|
1186
1185
|
const parsedToken = _parseToken(token);
|
|
1187
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1188
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1189
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1186
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1187
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1188
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1190
1189
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1191
1190
|
}
|
|
1192
1191
|
|
|
@@ -1223,8 +1222,8 @@ async function _logoutIfInvalidated(user, promise, bypassAuthState = false) {
|
|
|
1223
1222
|
}
|
|
1224
1223
|
}
|
|
1225
1224
|
function isUserInvalidated({ code }) {
|
|
1226
|
-
return (code === `auth/${"user-disabled" /* USER_DISABLED */}` ||
|
|
1227
|
-
code === `auth/${"user-token-expired" /* TOKEN_EXPIRED */}`);
|
|
1225
|
+
return (code === `auth/${"user-disabled" /* AuthErrorCode.USER_DISABLED */}` ||
|
|
1226
|
+
code === `auth/${"user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */}`);
|
|
1228
1227
|
}
|
|
1229
1228
|
|
|
1230
1229
|
/**
|
|
@@ -1252,7 +1251,7 @@ class ProactiveRefresh {
|
|
|
1252
1251
|
// we can't cast properly in both environments.
|
|
1253
1252
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1254
1253
|
this.timerId = null;
|
|
1255
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1254
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1256
1255
|
}
|
|
1257
1256
|
_start() {
|
|
1258
1257
|
if (this.isRunning) {
|
|
@@ -1274,14 +1273,14 @@ class ProactiveRefresh {
|
|
|
1274
1273
|
var _a;
|
|
1275
1274
|
if (wasError) {
|
|
1276
1275
|
const interval = this.errorBackoff;
|
|
1277
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1276
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1278
1277
|
return interval;
|
|
1279
1278
|
}
|
|
1280
1279
|
else {
|
|
1281
1280
|
// Reset the error backoff
|
|
1282
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1281
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1283
1282
|
const expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1284
|
-
const interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1283
|
+
const interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1285
1284
|
return Math.max(0, interval);
|
|
1286
1285
|
}
|
|
1287
1286
|
}
|
|
@@ -1296,14 +1295,13 @@ class ProactiveRefresh {
|
|
|
1296
1295
|
}, interval);
|
|
1297
1296
|
}
|
|
1298
1297
|
async iteration() {
|
|
1299
|
-
var _a;
|
|
1300
1298
|
try {
|
|
1301
1299
|
await this.user.getIdToken(true);
|
|
1302
1300
|
}
|
|
1303
1301
|
catch (e) {
|
|
1304
1302
|
// Only retry on network errors
|
|
1305
|
-
if ((
|
|
1306
|
-
`auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
|
|
1303
|
+
if ((e === null || e === void 0 ? void 0 : e.code) ===
|
|
1304
|
+
`auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {
|
|
1307
1305
|
this.schedule(/* wasError */ true);
|
|
1308
1306
|
}
|
|
1309
1307
|
return;
|
|
@@ -1372,7 +1370,7 @@ async function _reloadWithoutSaving(user) {
|
|
|
1372
1370
|
const auth = user.auth;
|
|
1373
1371
|
const idToken = await user.getIdToken();
|
|
1374
1372
|
const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { idToken }));
|
|
1375
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1373
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1376
1374
|
const coreAccount = response.users[0];
|
|
1377
1375
|
user._notifyReloadListener(coreAccount);
|
|
1378
1376
|
const newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1458,11 +1456,11 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1458
1456
|
'refresh_token': refreshToken
|
|
1459
1457
|
}).slice(1);
|
|
1460
1458
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1461
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, `key=${apiKey}`);
|
|
1459
|
+
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1462
1460
|
const headers = await auth._getAdditionalHeaders();
|
|
1463
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1461
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1464
1462
|
return FetchProvider.fetch()(url, {
|
|
1465
|
-
method: "POST" /* POST */,
|
|
1463
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1466
1464
|
headers,
|
|
1467
1465
|
body
|
|
1468
1466
|
});
|
|
@@ -1505,19 +1503,19 @@ class StsTokenManager {
|
|
|
1505
1503
|
}
|
|
1506
1504
|
get isExpired() {
|
|
1507
1505
|
return (!this.expirationTime ||
|
|
1508
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1506
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1509
1507
|
}
|
|
1510
1508
|
updateFromServerResponse(response) {
|
|
1511
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1512
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1513
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1509
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1510
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1511
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1514
1512
|
const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1515
1513
|
? Number(response.expiresIn)
|
|
1516
1514
|
: _tokenExpiresIn(response.idToken);
|
|
1517
1515
|
this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
|
|
1518
1516
|
}
|
|
1519
1517
|
async getToken(auth, forceRefresh = false) {
|
|
1520
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1518
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1521
1519
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1522
1520
|
return this.accessToken;
|
|
1523
1521
|
}
|
|
@@ -1543,19 +1541,19 @@ class StsTokenManager {
|
|
|
1543
1541
|
const { refreshToken, accessToken, expirationTime } = object;
|
|
1544
1542
|
const manager = new StsTokenManager();
|
|
1545
1543
|
if (refreshToken) {
|
|
1546
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1544
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1547
1545
|
appName
|
|
1548
1546
|
});
|
|
1549
1547
|
manager.refreshToken = refreshToken;
|
|
1550
1548
|
}
|
|
1551
1549
|
if (accessToken) {
|
|
1552
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1550
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1553
1551
|
appName
|
|
1554
1552
|
});
|
|
1555
1553
|
manager.accessToken = accessToken;
|
|
1556
1554
|
}
|
|
1557
1555
|
if (expirationTime) {
|
|
1558
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1556
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1559
1557
|
appName
|
|
1560
1558
|
});
|
|
1561
1559
|
manager.expirationTime = expirationTime;
|
|
@@ -1599,13 +1597,13 @@ class StsTokenManager {
|
|
|
1599
1597
|
* limitations under the License.
|
|
1600
1598
|
*/
|
|
1601
1599
|
function assertStringOrUndefined(assertion, appName) {
|
|
1602
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName });
|
|
1600
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName });
|
|
1603
1601
|
}
|
|
1604
1602
|
class UserImpl {
|
|
1605
1603
|
constructor(_a) {
|
|
1606
1604
|
var { uid, auth, stsTokenManager } = _a, opt = __rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1607
1605
|
// For the user object, provider is always Firebase.
|
|
1608
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1606
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1609
1607
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1610
1608
|
this.reloadUserInfo = null;
|
|
1611
1609
|
this.reloadListener = null;
|
|
@@ -1625,7 +1623,7 @@ class UserImpl {
|
|
|
1625
1623
|
}
|
|
1626
1624
|
async getIdToken(forceRefresh) {
|
|
1627
1625
|
const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh));
|
|
1628
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1626
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1629
1627
|
if (this.accessToken !== accessToken) {
|
|
1630
1628
|
this.accessToken = accessToken;
|
|
1631
1629
|
await this.auth._persistUserIfCurrent(this);
|
|
@@ -1643,7 +1641,7 @@ class UserImpl {
|
|
|
1643
1641
|
if (this === user) {
|
|
1644
1642
|
return;
|
|
1645
1643
|
}
|
|
1646
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1644
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1647
1645
|
this.displayName = user.displayName;
|
|
1648
1646
|
this.photoURL = user.photoURL;
|
|
1649
1647
|
this.email = user.email;
|
|
@@ -1660,7 +1658,7 @@ class UserImpl {
|
|
|
1660
1658
|
}
|
|
1661
1659
|
_onReload(callback) {
|
|
1662
1660
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1663
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1661
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1664
1662
|
this.reloadListener = callback;
|
|
1665
1663
|
if (this.reloadUserInfo) {
|
|
1666
1664
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -1727,13 +1725,13 @@ class UserImpl {
|
|
|
1727
1725
|
const createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1728
1726
|
const lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
1729
1727
|
const { uid, emailVerified, isAnonymous, providerData, stsTokenManager: plainObjectTokenManager } = object;
|
|
1730
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1728
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1731
1729
|
const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
1732
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1730
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1733
1731
|
assertStringOrUndefined(displayName, auth.name);
|
|
1734
1732
|
assertStringOrUndefined(email, auth.name);
|
|
1735
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1736
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1733
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1734
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1737
1735
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
1738
1736
|
assertStringOrUndefined(photoURL, auth.name);
|
|
1739
1737
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -1801,7 +1799,7 @@ class UserImpl {
|
|
|
1801
1799
|
*/
|
|
1802
1800
|
class InMemoryPersistence {
|
|
1803
1801
|
constructor() {
|
|
1804
|
-
this.type = "NONE" /* NONE */;
|
|
1802
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
1805
1803
|
this.storage = {};
|
|
1806
1804
|
}
|
|
1807
1805
|
async _isAvailable() {
|
|
@@ -1851,7 +1849,7 @@ const inMemoryPersistence = InMemoryPersistence;
|
|
|
1851
1849
|
* limitations under the License.
|
|
1852
1850
|
*/
|
|
1853
1851
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
1854
|
-
return `${"firebase" /* PERSISTENCE */}:${key}:${apiKey}:${appName}`;
|
|
1852
|
+
return `${"firebase" /* Namespace.PERSISTENCE */}:${key}:${apiKey}:${appName}`;
|
|
1855
1853
|
}
|
|
1856
1854
|
class PersistenceUserManager {
|
|
1857
1855
|
constructor(persistence, auth, userKey) {
|
|
@@ -1860,7 +1858,7 @@ class PersistenceUserManager {
|
|
|
1860
1858
|
this.userKey = userKey;
|
|
1861
1859
|
const { config, name } = this.auth;
|
|
1862
1860
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
1863
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
1861
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
1864
1862
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
1865
1863
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
1866
1864
|
}
|
|
@@ -1891,7 +1889,7 @@ class PersistenceUserManager {
|
|
|
1891
1889
|
delete() {
|
|
1892
1890
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
1893
1891
|
}
|
|
1894
|
-
static async create(auth, persistenceHierarchy, userKey = "authUser" /* AUTH_USER */) {
|
|
1892
|
+
static async create(auth, persistenceHierarchy, userKey = "authUser" /* KeyName.AUTH_USER */) {
|
|
1895
1893
|
if (!persistenceHierarchy.length) {
|
|
1896
1894
|
return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);
|
|
1897
1895
|
}
|
|
@@ -1976,42 +1974,42 @@ class PersistenceUserManager {
|
|
|
1976
1974
|
function _getBrowserName(userAgent) {
|
|
1977
1975
|
const ua = userAgent.toLowerCase();
|
|
1978
1976
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
1979
|
-
return "Opera" /* OPERA */;
|
|
1977
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
1980
1978
|
}
|
|
1981
1979
|
else if (_isIEMobile(ua)) {
|
|
1982
1980
|
// Windows phone IEMobile browser.
|
|
1983
|
-
return "IEMobile" /* IEMOBILE */;
|
|
1981
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
1984
1982
|
}
|
|
1985
1983
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
1986
|
-
return "IE" /* IE */;
|
|
1984
|
+
return "IE" /* BrowserName.IE */;
|
|
1987
1985
|
}
|
|
1988
1986
|
else if (ua.includes('edge/')) {
|
|
1989
|
-
return "Edge" /* EDGE */;
|
|
1987
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
1990
1988
|
}
|
|
1991
1989
|
else if (_isFirefox(ua)) {
|
|
1992
|
-
return "Firefox" /* FIREFOX */;
|
|
1990
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
1993
1991
|
}
|
|
1994
1992
|
else if (ua.includes('silk/')) {
|
|
1995
|
-
return "Silk" /* SILK */;
|
|
1993
|
+
return "Silk" /* BrowserName.SILK */;
|
|
1996
1994
|
}
|
|
1997
1995
|
else if (_isBlackBerry(ua)) {
|
|
1998
1996
|
// Blackberry browser.
|
|
1999
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
1997
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
2000
1998
|
}
|
|
2001
1999
|
else if (_isWebOS(ua)) {
|
|
2002
2000
|
// WebOS default browser.
|
|
2003
|
-
return "Webos" /* WEBOS */;
|
|
2001
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
2004
2002
|
}
|
|
2005
2003
|
else if (_isSafari(ua)) {
|
|
2006
|
-
return "Safari" /* SAFARI */;
|
|
2004
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
2007
2005
|
}
|
|
2008
2006
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
2009
2007
|
!ua.includes('edge/')) {
|
|
2010
|
-
return "Chrome" /* CHROME */;
|
|
2008
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
2011
2009
|
}
|
|
2012
2010
|
else if (_isAndroid(ua)) {
|
|
2013
2011
|
// Android stock browser.
|
|
2014
|
-
return "Android" /* ANDROID */;
|
|
2012
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
2015
2013
|
}
|
|
2016
2014
|
else {
|
|
2017
2015
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -2021,7 +2019,7 @@ function _getBrowserName(userAgent) {
|
|
|
2021
2019
|
return matches[1];
|
|
2022
2020
|
}
|
|
2023
2021
|
}
|
|
2024
|
-
return "Other" /* OTHER */;
|
|
2022
|
+
return "Other" /* BrowserName.OTHER */;
|
|
2025
2023
|
}
|
|
2026
2024
|
function _isFirefox(ua = getUA()) {
|
|
2027
2025
|
return /firefox\//i.test(ua);
|
|
@@ -2105,11 +2103,11 @@ function _isIframe() {
|
|
|
2105
2103
|
function _getClientVersion(clientPlatform, frameworks = []) {
|
|
2106
2104
|
let reportedPlatform;
|
|
2107
2105
|
switch (clientPlatform) {
|
|
2108
|
-
case "Browser" /* BROWSER */:
|
|
2106
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
2109
2107
|
// In a browser environment, report the browser name.
|
|
2110
2108
|
reportedPlatform = _getBrowserName(getUA());
|
|
2111
2109
|
break;
|
|
2112
|
-
case "Worker" /* WORKER */:
|
|
2110
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
2113
2111
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
2114
2112
|
// worker from a browser.
|
|
2115
2113
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
@@ -2121,7 +2119,7 @@ function _getClientVersion(clientPlatform, frameworks = []) {
|
|
|
2121
2119
|
const reportedFrameworks = frameworks.length
|
|
2122
2120
|
? frameworks.join(',')
|
|
2123
2121
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
2124
|
-
return `${reportedPlatform}/${"JsCore" /* CORE */}/${SDK_VERSION}/${reportedFrameworks}`;
|
|
2122
|
+
return `${reportedPlatform}/${"JsCore" /* ClientImplementation.CORE */}/${SDK_VERSION}/${reportedFrameworks}`;
|
|
2125
2123
|
}
|
|
2126
2124
|
|
|
2127
2125
|
/**
|
|
@@ -2171,7 +2169,6 @@ class AuthMiddlewareQueue {
|
|
|
2171
2169
|
};
|
|
2172
2170
|
}
|
|
2173
2171
|
async runMiddleware(nextUser) {
|
|
2174
|
-
var _a;
|
|
2175
2172
|
if (this.auth.currentUser === nextUser) {
|
|
2176
2173
|
return;
|
|
2177
2174
|
}
|
|
@@ -2199,8 +2196,8 @@ class AuthMiddlewareQueue {
|
|
|
2199
2196
|
/* swallow error */
|
|
2200
2197
|
}
|
|
2201
2198
|
}
|
|
2202
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2203
|
-
originalMessage:
|
|
2199
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2200
|
+
originalMessage: e === null || e === void 0 ? void 0 : e.message
|
|
2204
2201
|
});
|
|
2205
2202
|
}
|
|
2206
2203
|
}
|
|
@@ -2360,7 +2357,7 @@ class AuthImpl {
|
|
|
2360
2357
|
return this.directlySetCurrentUser(null);
|
|
2361
2358
|
}
|
|
2362
2359
|
}
|
|
2363
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2360
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2364
2361
|
await this.getOrInitRedirectPersistenceManager();
|
|
2365
2362
|
// If the redirect user's event ID matches the current user's event ID,
|
|
2366
2363
|
// DO NOT reload the current user, otherwise they'll be cleared from storage.
|
|
@@ -2401,13 +2398,12 @@ class AuthImpl {
|
|
|
2401
2398
|
return result;
|
|
2402
2399
|
}
|
|
2403
2400
|
async reloadAndSetCurrentUserOrClear(user) {
|
|
2404
|
-
var _a;
|
|
2405
2401
|
try {
|
|
2406
2402
|
await _reloadWithoutSaving(user);
|
|
2407
2403
|
}
|
|
2408
2404
|
catch (e) {
|
|
2409
|
-
if ((
|
|
2410
|
-
`auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
|
|
2405
|
+
if ((e === null || e === void 0 ? void 0 : e.code) !==
|
|
2406
|
+
`auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {
|
|
2411
2407
|
// Something's wrong with the user's token. Log them out and remove
|
|
2412
2408
|
// them from storage
|
|
2413
2409
|
return this.directlySetCurrentUser(null);
|
|
@@ -2428,7 +2424,7 @@ class AuthImpl {
|
|
|
2428
2424
|
? getModularInstance(userExtern)
|
|
2429
2425
|
: null;
|
|
2430
2426
|
if (user) {
|
|
2431
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2427
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2432
2428
|
}
|
|
2433
2429
|
return this._updateCurrentUser(user && user._clone(this));
|
|
2434
2430
|
}
|
|
@@ -2437,7 +2433,7 @@ class AuthImpl {
|
|
|
2437
2433
|
return;
|
|
2438
2434
|
}
|
|
2439
2435
|
if (user) {
|
|
2440
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2436
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2441
2437
|
}
|
|
2442
2438
|
if (!skipBeforeStateCallbacks) {
|
|
2443
2439
|
await this.beforeStateQueue.runMiddleware(user);
|
|
@@ -2497,8 +2493,8 @@ class AuthImpl {
|
|
|
2497
2493
|
if (!this.redirectPersistenceManager) {
|
|
2498
2494
|
const resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
2499
2495
|
this._popupRedirectResolver;
|
|
2500
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2501
|
-
this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */);
|
|
2496
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2497
|
+
this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */);
|
|
2502
2498
|
this.redirectUser =
|
|
2503
2499
|
await this.redirectPersistenceManager.getCurrentUser();
|
|
2504
2500
|
}
|
|
@@ -2571,7 +2567,7 @@ class AuthImpl {
|
|
|
2571
2567
|
const promise = this._isInitialized
|
|
2572
2568
|
? Promise.resolve()
|
|
2573
2569
|
: this._initializationPromise;
|
|
2574
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
2570
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2575
2571
|
// The callback needs to be called asynchronously per the spec.
|
|
2576
2572
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2577
2573
|
promise.then(() => cb(this.currentUser));
|
|
@@ -2609,7 +2605,7 @@ class AuthImpl {
|
|
|
2609
2605
|
return this.operations;
|
|
2610
2606
|
}
|
|
2611
2607
|
get assertedPersistence() {
|
|
2612
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
2608
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2613
2609
|
return this.persistenceManager;
|
|
2614
2610
|
}
|
|
2615
2611
|
_logFramework(framework) {
|
|
@@ -2629,10 +2625,10 @@ class AuthImpl {
|
|
|
2629
2625
|
var _a;
|
|
2630
2626
|
// Additional headers on every request
|
|
2631
2627
|
const headers = {
|
|
2632
|
-
["X-Client-Version" /* X_CLIENT_VERSION */]: this.clientVersion
|
|
2628
|
+
["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */]: this.clientVersion
|
|
2633
2629
|
};
|
|
2634
2630
|
if (this.app.options.appId) {
|
|
2635
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
2631
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
2636
2632
|
}
|
|
2637
2633
|
// If the heartbeat service exists, add the heartbeat string
|
|
2638
2634
|
const heartbeatsHeader = await ((_a = this.heartbeatServiceProvider
|
|
@@ -2640,7 +2636,7 @@ class AuthImpl {
|
|
|
2640
2636
|
optional: true
|
|
2641
2637
|
})) === null || _a === void 0 ? void 0 : _a.getHeartbeatsHeader());
|
|
2642
2638
|
if (heartbeatsHeader) {
|
|
2643
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
2639
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
2644
2640
|
}
|
|
2645
2641
|
return headers;
|
|
2646
2642
|
}
|
|
@@ -2662,7 +2658,7 @@ class Subscription {
|
|
|
2662
2658
|
this.addObserver = createSubscribe(observer => (this.observer = observer));
|
|
2663
2659
|
}
|
|
2664
2660
|
get next() {
|
|
2665
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2661
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2666
2662
|
return this.observer.next.bind(this.observer);
|
|
2667
2663
|
}
|
|
2668
2664
|
}
|
|
@@ -2691,8 +2687,8 @@ class Subscription {
|
|
|
2691
2687
|
*/
|
|
2692
2688
|
function connectAuthEmulator(auth, url, options) {
|
|
2693
2689
|
const authInternal = _castAuth(auth);
|
|
2694
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
2695
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
2690
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
2691
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
2696
2692
|
const disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
2697
2693
|
const protocol = extractProtocol(url);
|
|
2698
2694
|
const { host, port } = extractHostAndPort(url);
|
|
@@ -2860,13 +2856,13 @@ class AuthCredential {
|
|
|
2860
2856
|
* limitations under the License.
|
|
2861
2857
|
*/
|
|
2862
2858
|
async function resetPassword(auth, request) {
|
|
2863
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2859
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2864
2860
|
}
|
|
2865
2861
|
async function updateEmailPassword(auth, request) {
|
|
2866
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
2862
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
2867
2863
|
}
|
|
2868
2864
|
async function applyActionCode$1(auth, request) {
|
|
2869
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));
|
|
2865
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));
|
|
2870
2866
|
}
|
|
2871
2867
|
|
|
2872
2868
|
/**
|
|
@@ -2886,10 +2882,10 @@ async function applyActionCode$1(auth, request) {
|
|
|
2886
2882
|
* limitations under the License.
|
|
2887
2883
|
*/
|
|
2888
2884
|
async function signInWithPassword(auth, request) {
|
|
2889
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2885
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2890
2886
|
}
|
|
2891
2887
|
async function sendOobCode(auth, request) {
|
|
2892
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request));
|
|
2888
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request));
|
|
2893
2889
|
}
|
|
2894
2890
|
async function sendEmailVerification$1(auth, request) {
|
|
2895
2891
|
return sendOobCode(auth, request);
|
|
@@ -2921,10 +2917,10 @@ async function verifyAndChangeEmail(auth, request) {
|
|
|
2921
2917
|
* limitations under the License.
|
|
2922
2918
|
*/
|
|
2923
2919
|
async function signInWithEmailLink$1(auth, request) {
|
|
2924
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2920
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2925
2921
|
}
|
|
2926
2922
|
async function signInWithEmailLinkForLinking(auth, request) {
|
|
2927
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2923
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2928
2924
|
}
|
|
2929
2925
|
|
|
2930
2926
|
/**
|
|
@@ -2962,18 +2958,18 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
2962
2958
|
_password, signInMethod,
|
|
2963
2959
|
/** @internal */
|
|
2964
2960
|
_tenantId = null) {
|
|
2965
|
-
super("password" /* PASSWORD */, signInMethod);
|
|
2961
|
+
super("password" /* ProviderId.PASSWORD */, signInMethod);
|
|
2966
2962
|
this._email = _email;
|
|
2967
2963
|
this._password = _password;
|
|
2968
2964
|
this._tenantId = _tenantId;
|
|
2969
2965
|
}
|
|
2970
2966
|
/** @internal */
|
|
2971
2967
|
static _fromEmailAndPassword(email, password) {
|
|
2972
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
2968
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
2973
2969
|
}
|
|
2974
2970
|
/** @internal */
|
|
2975
2971
|
static _fromEmailAndCode(email, oobCode, tenantId = null) {
|
|
2976
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
2972
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
2977
2973
|
}
|
|
2978
2974
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
2979
2975
|
toJSON() {
|
|
@@ -2995,10 +2991,10 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
2995
2991
|
static fromJSON(json) {
|
|
2996
2992
|
const obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
2997
2993
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
2998
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
2994
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
2999
2995
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
3000
2996
|
}
|
|
3001
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
2997
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
3002
2998
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
3003
2999
|
}
|
|
3004
3000
|
}
|
|
@@ -3007,39 +3003,39 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3007
3003
|
/** @internal */
|
|
3008
3004
|
async _getIdTokenResponse(auth) {
|
|
3009
3005
|
switch (this.signInMethod) {
|
|
3010
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3006
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3011
3007
|
return signInWithPassword(auth, {
|
|
3012
3008
|
returnSecureToken: true,
|
|
3013
3009
|
email: this._email,
|
|
3014
3010
|
password: this._password
|
|
3015
3011
|
});
|
|
3016
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3012
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3017
3013
|
return signInWithEmailLink$1(auth, {
|
|
3018
3014
|
email: this._email,
|
|
3019
3015
|
oobCode: this._password
|
|
3020
3016
|
});
|
|
3021
3017
|
default:
|
|
3022
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3018
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3023
3019
|
}
|
|
3024
3020
|
}
|
|
3025
3021
|
/** @internal */
|
|
3026
3022
|
async _linkToIdToken(auth, idToken) {
|
|
3027
3023
|
switch (this.signInMethod) {
|
|
3028
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3024
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3029
3025
|
return updateEmailPassword(auth, {
|
|
3030
3026
|
idToken,
|
|
3031
3027
|
returnSecureToken: true,
|
|
3032
3028
|
email: this._email,
|
|
3033
3029
|
password: this._password
|
|
3034
3030
|
});
|
|
3035
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3031
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3036
3032
|
return signInWithEmailLinkForLinking(auth, {
|
|
3037
3033
|
idToken,
|
|
3038
3034
|
email: this._email,
|
|
3039
3035
|
oobCode: this._password
|
|
3040
3036
|
});
|
|
3041
3037
|
default:
|
|
3042
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3038
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3043
3039
|
}
|
|
3044
3040
|
}
|
|
3045
3041
|
/** @internal */
|
|
@@ -3065,7 +3061,7 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3065
3061
|
* limitations under the License.
|
|
3066
3062
|
*/
|
|
3067
3063
|
async function signInWithIdp(auth, request) {
|
|
3068
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));
|
|
3064
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));
|
|
3069
3065
|
}
|
|
3070
3066
|
|
|
3071
3067
|
/**
|
|
@@ -3123,7 +3119,7 @@ class OAuthCredential extends AuthCredential {
|
|
|
3123
3119
|
cred.secret = params.oauthTokenSecret;
|
|
3124
3120
|
}
|
|
3125
3121
|
else {
|
|
3126
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
3122
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3127
3123
|
}
|
|
3128
3124
|
return cred;
|
|
3129
3125
|
}
|
|
@@ -3225,24 +3221,24 @@ class OAuthCredential extends AuthCredential {
|
|
|
3225
3221
|
* limitations under the License.
|
|
3226
3222
|
*/
|
|
3227
3223
|
async function sendPhoneVerificationCode(auth, request) {
|
|
3228
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendVerificationCode" /* SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request));
|
|
3224
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendVerificationCode" /* Endpoint.SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request));
|
|
3229
3225
|
}
|
|
3230
3226
|
async function signInWithPhoneNumber$1(auth, request) {
|
|
3231
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3227
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3232
3228
|
}
|
|
3233
3229
|
async function linkWithPhoneNumber$1(auth, request) {
|
|
3234
|
-
const response = await _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3230
|
+
const response = await _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3235
3231
|
if (response.temporaryProof) {
|
|
3236
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
3232
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
3237
3233
|
}
|
|
3238
3234
|
return response;
|
|
3239
3235
|
}
|
|
3240
3236
|
const VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = {
|
|
3241
|
-
["USER_NOT_FOUND" /* USER_NOT_FOUND */]: "user-not-found" /* USER_DELETED */
|
|
3237
|
+
["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */
|
|
3242
3238
|
};
|
|
3243
3239
|
async function verifyPhoneNumberForExisting(auth, request) {
|
|
3244
3240
|
const apiRequest = Object.assign(Object.assign({}, request), { operation: 'REAUTH' });
|
|
3245
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_);
|
|
3241
|
+
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_);
|
|
3246
3242
|
}
|
|
3247
3243
|
|
|
3248
3244
|
/**
|
|
@@ -3268,7 +3264,7 @@ async function verifyPhoneNumberForExisting(auth, request) {
|
|
|
3268
3264
|
*/
|
|
3269
3265
|
class PhoneAuthCredential extends AuthCredential {
|
|
3270
3266
|
constructor(params) {
|
|
3271
|
-
super("phone" /* PHONE */, "phone" /* PHONE */);
|
|
3267
|
+
super("phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */);
|
|
3272
3268
|
this.params = params;
|
|
3273
3269
|
}
|
|
3274
3270
|
/** @internal */
|
|
@@ -3366,17 +3362,17 @@ class PhoneAuthCredential extends AuthCredential {
|
|
|
3366
3362
|
function parseMode(mode) {
|
|
3367
3363
|
switch (mode) {
|
|
3368
3364
|
case 'recoverEmail':
|
|
3369
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
3365
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
3370
3366
|
case 'resetPassword':
|
|
3371
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
3367
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
3372
3368
|
case 'signIn':
|
|
3373
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
3369
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
3374
3370
|
case 'verifyEmail':
|
|
3375
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
3371
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
3376
3372
|
case 'verifyAndChangeEmail':
|
|
3377
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
3373
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
3378
3374
|
case 'revertSecondFactorAddition':
|
|
3379
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
3375
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
3380
3376
|
default:
|
|
3381
3377
|
return null;
|
|
3382
3378
|
}
|
|
@@ -3415,17 +3411,17 @@ class ActionCodeURL {
|
|
|
3415
3411
|
constructor(actionLink) {
|
|
3416
3412
|
var _a, _b, _c, _d, _e, _f;
|
|
3417
3413
|
const searchParams = querystringDecode(extractQuerystring(actionLink));
|
|
3418
|
-
const apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3419
|
-
const code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3420
|
-
const operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3414
|
+
const apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3415
|
+
const code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3416
|
+
const operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3421
3417
|
// Validate API key, code and mode.
|
|
3422
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
3418
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3423
3419
|
this.apiKey = apiKey;
|
|
3424
3420
|
this.operation = operation;
|
|
3425
3421
|
this.code = code;
|
|
3426
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3427
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3428
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3422
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3423
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3424
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3429
3425
|
}
|
|
3430
3426
|
/**
|
|
3431
3427
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -3529,22 +3525,22 @@ class EmailAuthProvider {
|
|
|
3529
3525
|
*/
|
|
3530
3526
|
static credentialWithLink(email, emailLink) {
|
|
3531
3527
|
const actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
3532
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
3528
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3533
3529
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
3534
3530
|
}
|
|
3535
3531
|
}
|
|
3536
3532
|
/**
|
|
3537
3533
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
3538
3534
|
*/
|
|
3539
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
3535
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
3540
3536
|
/**
|
|
3541
3537
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
3542
3538
|
*/
|
|
3543
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
3539
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
3544
3540
|
/**
|
|
3545
3541
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
3546
3542
|
*/
|
|
3547
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
3543
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
3548
3544
|
|
|
3549
3545
|
/**
|
|
3550
3546
|
* @license
|
|
@@ -3706,7 +3702,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3706
3702
|
*/
|
|
3707
3703
|
static credentialFromJSON(json) {
|
|
3708
3704
|
const obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
3709
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
3705
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3710
3706
|
return OAuthCredential._fromParams(obj);
|
|
3711
3707
|
}
|
|
3712
3708
|
/**
|
|
@@ -3735,7 +3731,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3735
3731
|
}
|
|
3736
3732
|
/** An internal credential method that accepts more permissive options */
|
|
3737
3733
|
_credential(params) {
|
|
3738
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
3734
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3739
3735
|
// For OAuthCredential, sign in method is same as providerId.
|
|
3740
3736
|
return OAuthCredential._fromParams(Object.assign(Object.assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
3741
3737
|
}
|
|
@@ -3841,7 +3837,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3841
3837
|
*/
|
|
3842
3838
|
class FacebookAuthProvider extends BaseOAuthProvider {
|
|
3843
3839
|
constructor() {
|
|
3844
|
-
super("facebook.com" /* FACEBOOK */);
|
|
3840
|
+
super("facebook.com" /* ProviderId.FACEBOOK */);
|
|
3845
3841
|
}
|
|
3846
3842
|
/**
|
|
3847
3843
|
* Creates a credential for Facebook.
|
|
@@ -3895,9 +3891,9 @@ class FacebookAuthProvider extends BaseOAuthProvider {
|
|
|
3895
3891
|
}
|
|
3896
3892
|
}
|
|
3897
3893
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
3898
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
3894
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
3899
3895
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
3900
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
3896
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
3901
3897
|
|
|
3902
3898
|
/**
|
|
3903
3899
|
* @license
|
|
@@ -3958,7 +3954,7 @@ FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
|
3958
3954
|
*/
|
|
3959
3955
|
class GoogleAuthProvider extends BaseOAuthProvider {
|
|
3960
3956
|
constructor() {
|
|
3961
|
-
super("google.com" /* GOOGLE */);
|
|
3957
|
+
super("google.com" /* ProviderId.GOOGLE */);
|
|
3962
3958
|
this.addScope('profile');
|
|
3963
3959
|
}
|
|
3964
3960
|
/**
|
|
@@ -4017,9 +4013,9 @@ class GoogleAuthProvider extends BaseOAuthProvider {
|
|
|
4017
4013
|
}
|
|
4018
4014
|
}
|
|
4019
4015
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
4020
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
4016
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
4021
4017
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
4022
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
4018
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
4023
4019
|
|
|
4024
4020
|
/**
|
|
4025
4021
|
* @license
|
|
@@ -4081,7 +4077,7 @@ GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
|
4081
4077
|
*/
|
|
4082
4078
|
class GithubAuthProvider extends BaseOAuthProvider {
|
|
4083
4079
|
constructor() {
|
|
4084
|
-
super("github.com" /* GITHUB */);
|
|
4080
|
+
super("github.com" /* ProviderId.GITHUB */);
|
|
4085
4081
|
}
|
|
4086
4082
|
/**
|
|
4087
4083
|
* Creates a credential for Github.
|
|
@@ -4128,9 +4124,9 @@ class GithubAuthProvider extends BaseOAuthProvider {
|
|
|
4128
4124
|
}
|
|
4129
4125
|
}
|
|
4130
4126
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
4131
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
4127
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
4132
4128
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
4133
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
4129
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
4134
4130
|
|
|
4135
4131
|
/**
|
|
4136
4132
|
* @license
|
|
@@ -4248,7 +4244,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4248
4244
|
* @param providerId - SAML provider ID.
|
|
4249
4245
|
*/
|
|
4250
4246
|
constructor(providerId) {
|
|
4251
|
-
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* ARGUMENT_ERROR */);
|
|
4247
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4252
4248
|
super(providerId);
|
|
4253
4249
|
}
|
|
4254
4250
|
/**
|
|
@@ -4285,7 +4281,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4285
4281
|
*/
|
|
4286
4282
|
static credentialFromJSON(json) {
|
|
4287
4283
|
const credential = SAMLAuthCredential.fromJSON(json);
|
|
4288
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
4284
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4289
4285
|
return credential;
|
|
4290
4286
|
}
|
|
4291
4287
|
static samlCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) {
|
|
@@ -4362,7 +4358,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4362
4358
|
*/
|
|
4363
4359
|
class TwitterAuthProvider extends BaseOAuthProvider {
|
|
4364
4360
|
constructor() {
|
|
4365
|
-
super("twitter.com" /* TWITTER */);
|
|
4361
|
+
super("twitter.com" /* ProviderId.TWITTER */);
|
|
4366
4362
|
}
|
|
4367
4363
|
/**
|
|
4368
4364
|
* Creates a credential for Twitter.
|
|
@@ -4412,9 +4408,9 @@ class TwitterAuthProvider extends BaseOAuthProvider {
|
|
|
4412
4408
|
}
|
|
4413
4409
|
}
|
|
4414
4410
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
4415
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
4411
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
4416
4412
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
4417
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
4413
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
4418
4414
|
|
|
4419
4415
|
/**
|
|
4420
4416
|
* @license
|
|
@@ -4433,7 +4429,7 @@ TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
|
4433
4429
|
* limitations under the License.
|
|
4434
4430
|
*/
|
|
4435
4431
|
async function signUp(auth, request) {
|
|
4436
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request));
|
|
4432
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request));
|
|
4437
4433
|
}
|
|
4438
4434
|
|
|
4439
4435
|
/**
|
|
@@ -4486,7 +4482,7 @@ function providerIdForResponse(response) {
|
|
|
4486
4482
|
return response.providerId;
|
|
4487
4483
|
}
|
|
4488
4484
|
if ('phoneNumber' in response) {
|
|
4489
|
-
return "phone" /* PHONE */;
|
|
4485
|
+
return "phone" /* ProviderId.PHONE */;
|
|
4490
4486
|
}
|
|
4491
4487
|
return null;
|
|
4492
4488
|
}
|
|
@@ -4527,13 +4523,13 @@ async function signInAnonymously(auth) {
|
|
|
4527
4523
|
return new UserCredentialImpl({
|
|
4528
4524
|
user: authInternal.currentUser,
|
|
4529
4525
|
providerId: null,
|
|
4530
|
-
operationType: "signIn" /* SIGN_IN */
|
|
4526
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
4531
4527
|
});
|
|
4532
4528
|
}
|
|
4533
4529
|
const response = await signUp(authInternal, {
|
|
4534
4530
|
returnSecureToken: true
|
|
4535
4531
|
});
|
|
4536
|
-
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true);
|
|
4532
|
+
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true);
|
|
4537
4533
|
await authInternal._updateCurrentUser(userCredential.user);
|
|
4538
4534
|
return userCredential;
|
|
4539
4535
|
}
|
|
@@ -4574,11 +4570,11 @@ class MultiFactorError extends FirebaseError {
|
|
|
4574
4570
|
}
|
|
4575
4571
|
}
|
|
4576
4572
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
4577
|
-
const idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
4573
|
+
const idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
4578
4574
|
? credential._getReauthenticationResolver(auth)
|
|
4579
4575
|
: credential._getIdTokenResponse(auth);
|
|
4580
4576
|
return idTokenProvider.catch(error => {
|
|
4581
|
-
if (error.code === `auth/${"multi-factor-auth-required" /* MFA_REQUIRED */}`) {
|
|
4577
|
+
if (error.code === `auth/${"multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */}`) {
|
|
4582
4578
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
4583
4579
|
}
|
|
4584
4580
|
throw error;
|
|
@@ -4643,7 +4639,7 @@ async function unlink(user, providerId) {
|
|
|
4643
4639
|
});
|
|
4644
4640
|
const providersLeft = providerDataAsNames(providerUserInfo || []);
|
|
4645
4641
|
userInternal.providerData = userInternal.providerData.filter(pd => providersLeft.has(pd.providerId));
|
|
4646
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
4642
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
4647
4643
|
userInternal.phoneNumber = null;
|
|
4648
4644
|
}
|
|
4649
4645
|
await userInternal.auth._persistUserIfCurrent(userInternal);
|
|
@@ -4651,14 +4647,14 @@ async function unlink(user, providerId) {
|
|
|
4651
4647
|
}
|
|
4652
4648
|
async function _link$1(user, credential, bypassAuthState = false) {
|
|
4653
4649
|
const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState);
|
|
4654
|
-
return UserCredentialImpl._forOperation(user, "link" /* LINK */, response);
|
|
4650
|
+
return UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response);
|
|
4655
4651
|
}
|
|
4656
4652
|
async function _assertLinkedStatus(expected, user, provider) {
|
|
4657
4653
|
await _reloadWithoutSaving(user);
|
|
4658
4654
|
const providerIds = providerDataAsNames(user.providerData);
|
|
4659
4655
|
const code = expected === false
|
|
4660
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
4661
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
4656
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
4657
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
4662
4658
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
4663
4659
|
}
|
|
4664
4660
|
|
|
@@ -4679,22 +4675,21 @@ async function _assertLinkedStatus(expected, user, provider) {
|
|
|
4679
4675
|
* limitations under the License.
|
|
4680
4676
|
*/
|
|
4681
4677
|
async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
4682
|
-
var _a;
|
|
4683
4678
|
const { auth } = user;
|
|
4684
|
-
const operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
4679
|
+
const operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
4685
4680
|
try {
|
|
4686
4681
|
const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);
|
|
4687
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4682
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4688
4683
|
const parsed = _parseToken(response.idToken);
|
|
4689
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4684
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4690
4685
|
const { sub: localId } = parsed;
|
|
4691
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
4686
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
4692
4687
|
return UserCredentialImpl._forOperation(user, operationType, response);
|
|
4693
4688
|
}
|
|
4694
4689
|
catch (e) {
|
|
4695
4690
|
// Convert user deleted error into user mismatch
|
|
4696
|
-
if ((
|
|
4697
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
4691
|
+
if ((e === null || e === void 0 ? void 0 : e.code) === `auth/${"user-not-found" /* AuthErrorCode.USER_DELETED */}`) {
|
|
4692
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
4698
4693
|
}
|
|
4699
4694
|
throw e;
|
|
4700
4695
|
}
|
|
@@ -4717,7 +4712,7 @@ async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
|
4717
4712
|
* limitations under the License.
|
|
4718
4713
|
*/
|
|
4719
4714
|
async function _signInWithCredential(auth, credential, bypassAuthState = false) {
|
|
4720
|
-
const operationType = "signIn" /* SIGN_IN */;
|
|
4715
|
+
const operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
4721
4716
|
const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);
|
|
4722
4717
|
const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);
|
|
4723
4718
|
if (!bypassAuthState) {
|
|
@@ -4788,7 +4783,7 @@ async function reauthenticateWithCredential(user, credential) {
|
|
|
4788
4783
|
* limitations under the License.
|
|
4789
4784
|
*/
|
|
4790
4785
|
async function signInWithCustomToken$1(auth, request) {
|
|
4791
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request));
|
|
4786
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request));
|
|
4792
4787
|
}
|
|
4793
4788
|
|
|
4794
4789
|
/**
|
|
@@ -4829,7 +4824,7 @@ async function signInWithCustomToken(auth, customToken) {
|
|
|
4829
4824
|
token: customToken,
|
|
4830
4825
|
returnSecureToken: true
|
|
4831
4826
|
});
|
|
4832
|
-
const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response);
|
|
4827
|
+
const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response);
|
|
4833
4828
|
await authInternal._updateCurrentUser(cred.user);
|
|
4834
4829
|
return cred;
|
|
4835
4830
|
}
|
|
@@ -4861,12 +4856,12 @@ class MultiFactorInfoImpl {
|
|
|
4861
4856
|
if ('phoneInfo' in enrollment) {
|
|
4862
4857
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
4863
4858
|
}
|
|
4864
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4859
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4865
4860
|
}
|
|
4866
4861
|
}
|
|
4867
4862
|
class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl {
|
|
4868
4863
|
constructor(response) {
|
|
4869
|
-
super("phone" /* PHONE */, response);
|
|
4864
|
+
super("phone" /* FactorId.PHONE */, response);
|
|
4870
4865
|
this.phoneNumber = response.phoneInfo;
|
|
4871
4866
|
}
|
|
4872
4867
|
static _fromServerResponse(_auth, enrollment) {
|
|
@@ -4892,18 +4887,18 @@ class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl {
|
|
|
4892
4887
|
*/
|
|
4893
4888
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
4894
4889
|
var _a;
|
|
4895
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
4890
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
4896
4891
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
4897
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
4892
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
4898
4893
|
request.continueUrl = actionCodeSettings.url;
|
|
4899
4894
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
4900
4895
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
4901
4896
|
if (actionCodeSettings.iOS) {
|
|
4902
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
4897
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
4903
4898
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
4904
4899
|
}
|
|
4905
4900
|
if (actionCodeSettings.android) {
|
|
4906
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
4901
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
4907
4902
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
4908
4903
|
request.androidMinimumVersionCode =
|
|
4909
4904
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -4962,7 +4957,7 @@ function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
|
4962
4957
|
async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
4963
4958
|
const authModular = getModularInstance(auth);
|
|
4964
4959
|
const request = {
|
|
4965
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
4960
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
4966
4961
|
email
|
|
4967
4962
|
};
|
|
4968
4963
|
if (actionCodeSettings) {
|
|
@@ -5017,18 +5012,18 @@ async function checkActionCode(auth, oobCode) {
|
|
|
5017
5012
|
// Multi-factor info could not be empty if the request type is
|
|
5018
5013
|
// REVERT_SECOND_FACTOR_ADDITION.
|
|
5019
5014
|
const operation = response.requestType;
|
|
5020
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5015
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5021
5016
|
switch (operation) {
|
|
5022
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
5017
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
5023
5018
|
break;
|
|
5024
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
5025
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5019
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
5020
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5026
5021
|
break;
|
|
5027
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
5028
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5022
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
5023
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5029
5024
|
// fall through
|
|
5030
5025
|
default:
|
|
5031
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5026
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5032
5027
|
}
|
|
5033
5028
|
// The multi-factor info for revert second factor addition
|
|
5034
5029
|
let multiFactorInfo = null;
|
|
@@ -5037,10 +5032,10 @@ async function checkActionCode(auth, oobCode) {
|
|
|
5037
5032
|
}
|
|
5038
5033
|
return {
|
|
5039
5034
|
data: {
|
|
5040
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5035
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5041
5036
|
? response.newEmail
|
|
5042
5037
|
: response.email) || null,
|
|
5043
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5038
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5044
5039
|
? response.email
|
|
5045
5040
|
: response.newEmail) || null,
|
|
5046
5041
|
multiFactorInfo
|
|
@@ -5087,7 +5082,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5087
5082
|
email,
|
|
5088
5083
|
password
|
|
5089
5084
|
});
|
|
5090
|
-
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response);
|
|
5085
|
+
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response);
|
|
5091
5086
|
await authInternal._updateCurrentUser(userCredential.user);
|
|
5092
5087
|
return userCredential;
|
|
5093
5088
|
}
|
|
@@ -5168,10 +5163,10 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
5168
5163
|
async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
5169
5164
|
const authModular = getModularInstance(auth);
|
|
5170
5165
|
const request = {
|
|
5171
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
5166
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
5172
5167
|
email
|
|
5173
5168
|
};
|
|
5174
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5169
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5175
5170
|
if (actionCodeSettings) {
|
|
5176
5171
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
5177
5172
|
}
|
|
@@ -5187,7 +5182,7 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5187
5182
|
*/
|
|
5188
5183
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
5189
5184
|
const actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
5190
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
5185
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
5191
5186
|
}
|
|
5192
5187
|
/**
|
|
5193
5188
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -5231,7 +5226,7 @@ async function signInWithEmailLink(auth, email, emailLink) {
|
|
|
5231
5226
|
const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
5232
5227
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
5233
5228
|
// instance.
|
|
5234
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
5229
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
5235
5230
|
return signInWithCredential(authModular, credential);
|
|
5236
5231
|
}
|
|
5237
5232
|
|
|
@@ -5252,7 +5247,7 @@ async function signInWithEmailLink(auth, email, emailLink) {
|
|
|
5252
5247
|
* limitations under the License.
|
|
5253
5248
|
*/
|
|
5254
5249
|
async function createAuthUri(auth, request) {
|
|
5255
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request));
|
|
5250
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request));
|
|
5256
5251
|
}
|
|
5257
5252
|
|
|
5258
5253
|
/**
|
|
@@ -5331,7 +5326,7 @@ async function sendEmailVerification(user, actionCodeSettings) {
|
|
|
5331
5326
|
const userInternal = getModularInstance(user);
|
|
5332
5327
|
const idToken = await user.getIdToken();
|
|
5333
5328
|
const request = {
|
|
5334
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
5329
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
5335
5330
|
idToken
|
|
5336
5331
|
};
|
|
5337
5332
|
if (actionCodeSettings) {
|
|
@@ -5380,7 +5375,7 @@ async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
5380
5375
|
const userInternal = getModularInstance(user);
|
|
5381
5376
|
const idToken = await user.getIdToken();
|
|
5382
5377
|
const request = {
|
|
5383
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
5378
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
5384
5379
|
idToken,
|
|
5385
5380
|
newEmail
|
|
5386
5381
|
};
|
|
@@ -5412,7 +5407,7 @@ async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
5412
5407
|
* limitations under the License.
|
|
5413
5408
|
*/
|
|
5414
5409
|
async function updateProfile$1(auth, request) {
|
|
5415
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
5410
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
5416
5411
|
}
|
|
5417
5412
|
|
|
5418
5413
|
/**
|
|
@@ -5455,7 +5450,7 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
|
|
|
5455
5450
|
userInternal.displayName = response.displayName || null;
|
|
5456
5451
|
userInternal.photoURL = response.photoUrl || null;
|
|
5457
5452
|
// Update the password provider as well
|
|
5458
|
-
const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === "password" /* PASSWORD */);
|
|
5453
|
+
const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === "password" /* ProviderId.PASSWORD */);
|
|
5459
5454
|
if (passwordProvider) {
|
|
5460
5455
|
passwordProvider.displayName = userInternal.displayName;
|
|
5461
5456
|
passwordProvider.photoURL = userInternal.photoURL;
|
|
@@ -5544,12 +5539,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
5544
5539
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
5545
5540
|
: {};
|
|
5546
5541
|
const isNewUser = idTokenResponse.isNewUser ||
|
|
5547
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
5542
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
5548
5543
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
5549
5544
|
const signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];
|
|
5550
5545
|
if (signInProvider) {
|
|
5551
|
-
const filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
5552
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
5546
|
+
const filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
5547
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
5553
5548
|
? signInProvider
|
|
5554
5549
|
: null;
|
|
5555
5550
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -5560,16 +5555,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
5560
5555
|
return null;
|
|
5561
5556
|
}
|
|
5562
5557
|
switch (providerId) {
|
|
5563
|
-
case "facebook.com" /* FACEBOOK */:
|
|
5558
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
5564
5559
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
5565
|
-
case "github.com" /* GITHUB */:
|
|
5560
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
5566
5561
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
5567
|
-
case "google.com" /* GOOGLE */:
|
|
5562
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
5568
5563
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
5569
|
-
case "twitter.com" /* TWITTER */:
|
|
5564
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
5570
5565
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
5571
|
-
case "custom" /* CUSTOM */:
|
|
5572
|
-
case "anonymous" /* ANONYMOUS */:
|
|
5566
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
5567
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
5573
5568
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
5574
5569
|
default:
|
|
5575
5570
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -5590,22 +5585,22 @@ class FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo
|
|
|
5590
5585
|
}
|
|
5591
5586
|
class FacebookAdditionalUserInfo extends GenericAdditionalUserInfo {
|
|
5592
5587
|
constructor(isNewUser, profile) {
|
|
5593
|
-
super(isNewUser, "facebook.com" /* FACEBOOK */, profile);
|
|
5588
|
+
super(isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile);
|
|
5594
5589
|
}
|
|
5595
5590
|
}
|
|
5596
5591
|
class GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {
|
|
5597
5592
|
constructor(isNewUser, profile) {
|
|
5598
|
-
super(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);
|
|
5593
|
+
super(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);
|
|
5599
5594
|
}
|
|
5600
5595
|
}
|
|
5601
5596
|
class GoogleAdditionalUserInfo extends GenericAdditionalUserInfo {
|
|
5602
5597
|
constructor(isNewUser, profile) {
|
|
5603
|
-
super(isNewUser, "google.com" /* GOOGLE */, profile);
|
|
5598
|
+
super(isNewUser, "google.com" /* ProviderId.GOOGLE */, profile);
|
|
5604
5599
|
}
|
|
5605
5600
|
}
|
|
5606
5601
|
class TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {
|
|
5607
5602
|
constructor(isNewUser, profile, screenName) {
|
|
5608
|
-
super(isNewUser, "twitter.com" /* TWITTER */, profile, screenName);
|
|
5603
|
+
super(isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName);
|
|
5609
5604
|
}
|
|
5610
5605
|
}
|
|
5611
5606
|
/**
|
|
@@ -5783,13 +5778,13 @@ class MultiFactorSessionImpl {
|
|
|
5783
5778
|
this.auth = auth;
|
|
5784
5779
|
}
|
|
5785
5780
|
static _fromIdtoken(idToken, auth) {
|
|
5786
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
5781
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
5787
5782
|
}
|
|
5788
5783
|
static _fromMfaPendingCredential(mfaPendingCredential) {
|
|
5789
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
5784
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
5790
5785
|
}
|
|
5791
5786
|
toJSON() {
|
|
5792
|
-
const key = this.type === "enroll" /* ENROLL */
|
|
5787
|
+
const key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
5793
5788
|
? 'idToken'
|
|
5794
5789
|
: 'pendingCredential';
|
|
5795
5790
|
return {
|
|
@@ -5839,7 +5834,7 @@ class MultiFactorResolverImpl {
|
|
|
5839
5834
|
const auth = _castAuth(authExtern);
|
|
5840
5835
|
const serverResponse = error.customData._serverResponse;
|
|
5841
5836
|
const hints = (serverResponse.mfaInfo || []).map(enrollment => MultiFactorInfoImpl._fromServerResponse(auth, enrollment));
|
|
5842
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5837
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5843
5838
|
const session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
5844
5839
|
return new MultiFactorResolverImpl(session, hints, async (assertion) => {
|
|
5845
5840
|
const mfaResponse = await assertion._process(auth, session);
|
|
@@ -5850,15 +5845,15 @@ class MultiFactorResolverImpl {
|
|
|
5850
5845
|
const idTokenResponse = Object.assign(Object.assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
5851
5846
|
// TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case
|
|
5852
5847
|
switch (error.operationType) {
|
|
5853
|
-
case "signIn" /* SIGN_IN */:
|
|
5848
|
+
case "signIn" /* OperationType.SIGN_IN */:
|
|
5854
5849
|
const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse);
|
|
5855
5850
|
await auth._updateCurrentUser(userCredential.user);
|
|
5856
5851
|
return userCredential;
|
|
5857
|
-
case "reauthenticate" /* REAUTHENTICATE */:
|
|
5858
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5852
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */:
|
|
5853
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5859
5854
|
return UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse);
|
|
5860
5855
|
default:
|
|
5861
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5856
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5862
5857
|
}
|
|
5863
5858
|
});
|
|
5864
5859
|
}
|
|
@@ -5881,8 +5876,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
5881
5876
|
var _a;
|
|
5882
5877
|
const authModular = getModularInstance(auth);
|
|
5883
5878
|
const errorInternal = error;
|
|
5884
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5885
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5879
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5880
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5886
5881
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
5887
5882
|
}
|
|
5888
5883
|
|
|
@@ -5903,13 +5898,13 @@ function getMultiFactorResolver(auth, error) {
|
|
|
5903
5898
|
* limitations under the License.
|
|
5904
5899
|
*/
|
|
5905
5900
|
function startEnrollPhoneMfa(auth, request) {
|
|
5906
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:start" /* START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
5901
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
5907
5902
|
}
|
|
5908
5903
|
function finalizeEnrollPhoneMfa(auth, request) {
|
|
5909
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:finalize" /* FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
5904
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
5910
5905
|
}
|
|
5911
5906
|
function withdrawMfa(auth, request) {
|
|
5912
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
5907
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
5913
5908
|
}
|
|
5914
5909
|
|
|
5915
5910
|
class MultiFactorUserImpl {
|
|
@@ -5941,7 +5936,6 @@ class MultiFactorUserImpl {
|
|
|
5941
5936
|
return this.user.reload();
|
|
5942
5937
|
}
|
|
5943
5938
|
async unenroll(infoOrUid) {
|
|
5944
|
-
var _a;
|
|
5945
5939
|
const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
5946
5940
|
const idToken = await this.user.getIdToken();
|
|
5947
5941
|
const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
@@ -5959,7 +5953,7 @@ class MultiFactorUserImpl {
|
|
|
5959
5953
|
await this.user.reload();
|
|
5960
5954
|
}
|
|
5961
5955
|
catch (e) {
|
|
5962
|
-
if ((
|
|
5956
|
+
if ((e === null || e === void 0 ? void 0 : e.code) !== `auth/${"user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */}`) {
|
|
5963
5957
|
throw e;
|
|
5964
5958
|
}
|
|
5965
5959
|
}
|
|
@@ -6066,7 +6060,7 @@ const _POLLING_INTERVAL_MS$1 = 1000;
|
|
|
6066
6060
|
const IE10_LOCAL_STORAGE_SYNC_DELAY = 10;
|
|
6067
6061
|
class BrowserLocalPersistence extends BrowserPersistenceClass {
|
|
6068
6062
|
constructor() {
|
|
6069
|
-
super(() => window.localStorage, "LOCAL" /* LOCAL */);
|
|
6063
|
+
super(() => window.localStorage, "LOCAL" /* PersistenceType.LOCAL */);
|
|
6070
6064
|
this.boundEventHandler = (event, poll) => this.onStorageEvent(event, poll);
|
|
6071
6065
|
this.listeners = {};
|
|
6072
6066
|
this.localCache = {};
|
|
@@ -6267,7 +6261,7 @@ const browserLocalPersistence = BrowserLocalPersistence;
|
|
|
6267
6261
|
*/
|
|
6268
6262
|
class BrowserSessionPersistence extends BrowserPersistenceClass {
|
|
6269
6263
|
constructor() {
|
|
6270
|
-
super(() => window.sessionStorage, "SESSION" /* SESSION */);
|
|
6264
|
+
super(() => window.sessionStorage, "SESSION" /* PersistenceType.SESSION */);
|
|
6271
6265
|
}
|
|
6272
6266
|
_addListener(_key, _listener) {
|
|
6273
6267
|
// Listeners are not supported for session storage since it cannot be shared across windows
|
|
@@ -6391,14 +6385,14 @@ class Receiver {
|
|
|
6391
6385
|
return;
|
|
6392
6386
|
}
|
|
6393
6387
|
messageEvent.ports[0].postMessage({
|
|
6394
|
-
status: "ack" /* ACK */,
|
|
6388
|
+
status: "ack" /* _Status.ACK */,
|
|
6395
6389
|
eventId,
|
|
6396
6390
|
eventType
|
|
6397
6391
|
});
|
|
6398
6392
|
const promises = Array.from(handlers).map(async (handler) => handler(messageEvent.origin, data));
|
|
6399
6393
|
const response = await _allSettled(promises);
|
|
6400
6394
|
messageEvent.ports[0].postMessage({
|
|
6401
|
-
status: "done" /* DONE */,
|
|
6395
|
+
status: "done" /* _Status.DONE */,
|
|
6402
6396
|
eventId,
|
|
6403
6397
|
eventType,
|
|
6404
6398
|
response
|
|
@@ -6515,10 +6509,10 @@ class Sender {
|
|
|
6515
6509
|
*
|
|
6516
6510
|
* @returns An array of settled promises from all the handlers that were listening on the receiver.
|
|
6517
6511
|
*/
|
|
6518
|
-
async _send(eventType, data, timeout = 50 /* ACK */) {
|
|
6512
|
+
async _send(eventType, data, timeout = 50 /* _TimeoutDuration.ACK */) {
|
|
6519
6513
|
const messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;
|
|
6520
6514
|
if (!messageChannel) {
|
|
6521
|
-
throw new Error("connection_unavailable" /* CONNECTION_UNAVAILABLE */);
|
|
6515
|
+
throw new Error("connection_unavailable" /* _MessageError.CONNECTION_UNAVAILABLE */);
|
|
6522
6516
|
}
|
|
6523
6517
|
// Node timers and browser timers return fundamentally different types.
|
|
6524
6518
|
// We don't actually care what the value is but TS won't accept unknown and
|
|
@@ -6530,7 +6524,7 @@ class Sender {
|
|
|
6530
6524
|
const eventId = _generateEventId('', 20);
|
|
6531
6525
|
messageChannel.port1.start();
|
|
6532
6526
|
const ackTimer = setTimeout(() => {
|
|
6533
|
-
reject(new Error("unsupported_event" /* UNSUPPORTED_EVENT */));
|
|
6527
|
+
reject(new Error("unsupported_event" /* _MessageError.UNSUPPORTED_EVENT */));
|
|
6534
6528
|
}, timeout);
|
|
6535
6529
|
handler = {
|
|
6536
6530
|
messageChannel,
|
|
@@ -6540,14 +6534,14 @@ class Sender {
|
|
|
6540
6534
|
return;
|
|
6541
6535
|
}
|
|
6542
6536
|
switch (messageEvent.data.status) {
|
|
6543
|
-
case "ack" /* ACK */:
|
|
6537
|
+
case "ack" /* _Status.ACK */:
|
|
6544
6538
|
// The receiver should ACK first.
|
|
6545
6539
|
clearTimeout(ackTimer);
|
|
6546
6540
|
completionTimer = setTimeout(() => {
|
|
6547
|
-
reject(new Error("timeout" /* TIMEOUT */));
|
|
6548
|
-
}, 3000 /* COMPLETION */);
|
|
6541
|
+
reject(new Error("timeout" /* _MessageError.TIMEOUT */));
|
|
6542
|
+
}, 3000 /* _TimeoutDuration.COMPLETION */);
|
|
6549
6543
|
break;
|
|
6550
|
-
case "done" /* DONE */:
|
|
6544
|
+
case "done" /* _Status.DONE */:
|
|
6551
6545
|
// Once the receiver's handlers are finished we will get the results.
|
|
6552
6546
|
clearTimeout(completionTimer);
|
|
6553
6547
|
resolve(messageEvent.data.response);
|
|
@@ -6555,7 +6549,7 @@ class Sender {
|
|
|
6555
6549
|
default:
|
|
6556
6550
|
clearTimeout(ackTimer);
|
|
6557
6551
|
clearTimeout(completionTimer);
|
|
6558
|
-
reject(new Error("invalid_response" /* INVALID_RESPONSE */));
|
|
6552
|
+
reject(new Error("invalid_response" /* _MessageError.INVALID_RESPONSE */));
|
|
6559
6553
|
break;
|
|
6560
6554
|
}
|
|
6561
6555
|
}
|
|
@@ -6745,7 +6739,7 @@ const _POLLING_INTERVAL_MS = 800;
|
|
|
6745
6739
|
const _TRANSACTION_RETRY_COUNT = 3;
|
|
6746
6740
|
class IndexedDBLocalPersistence {
|
|
6747
6741
|
constructor() {
|
|
6748
|
-
this.type = "LOCAL" /* LOCAL */;
|
|
6742
|
+
this.type = "LOCAL" /* PersistenceType.LOCAL */;
|
|
6749
6743
|
this._shouldAllowMigration = true;
|
|
6750
6744
|
this.listeners = {};
|
|
6751
6745
|
this.localCache = {};
|
|
@@ -6800,15 +6794,15 @@ class IndexedDBLocalPersistence {
|
|
|
6800
6794
|
async initializeReceiver() {
|
|
6801
6795
|
this.receiver = Receiver._getInstance(_getWorkerGlobalScope());
|
|
6802
6796
|
// Refresh from persistence if we receive a KeyChanged message.
|
|
6803
|
-
this.receiver._subscribe("keyChanged" /* KEY_CHANGED */, async (_origin, data) => {
|
|
6797
|
+
this.receiver._subscribe("keyChanged" /* _EventType.KEY_CHANGED */, async (_origin, data) => {
|
|
6804
6798
|
const keys = await this._poll();
|
|
6805
6799
|
return {
|
|
6806
6800
|
keyProcessed: keys.includes(data.key)
|
|
6807
6801
|
};
|
|
6808
6802
|
});
|
|
6809
6803
|
// Let the sender know that we are listening so they give us more timeout.
|
|
6810
|
-
this.receiver._subscribe("ping" /* PING */, async (_origin, _data) => {
|
|
6811
|
-
return ["keyChanged" /* KEY_CHANGED */];
|
|
6804
|
+
this.receiver._subscribe("ping" /* _EventType.PING */, async (_origin, _data) => {
|
|
6805
|
+
return ["keyChanged" /* _EventType.KEY_CHANGED */];
|
|
6812
6806
|
});
|
|
6813
6807
|
}
|
|
6814
6808
|
/**
|
|
@@ -6827,12 +6821,12 @@ class IndexedDBLocalPersistence {
|
|
|
6827
6821
|
}
|
|
6828
6822
|
this.sender = new Sender(this.activeServiceWorker);
|
|
6829
6823
|
// Ping the service worker to check what events they can handle.
|
|
6830
|
-
const results = await this.sender._send("ping" /* PING */, {}, 800 /* LONG_ACK */);
|
|
6824
|
+
const results = await this.sender._send("ping" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */);
|
|
6831
6825
|
if (!results) {
|
|
6832
6826
|
return;
|
|
6833
6827
|
}
|
|
6834
6828
|
if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&
|
|
6835
|
-
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* KEY_CHANGED */))) {
|
|
6829
|
+
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* _EventType.KEY_CHANGED */))) {
|
|
6836
6830
|
this.serviceWorkerReceiverAvailable = true;
|
|
6837
6831
|
}
|
|
6838
6832
|
}
|
|
@@ -6852,11 +6846,11 @@ class IndexedDBLocalPersistence {
|
|
|
6852
6846
|
return;
|
|
6853
6847
|
}
|
|
6854
6848
|
try {
|
|
6855
|
-
await this.sender._send("keyChanged" /* KEY_CHANGED */, { key },
|
|
6849
|
+
await this.sender._send("keyChanged" /* _EventType.KEY_CHANGED */, { key },
|
|
6856
6850
|
// Use long timeout if receiver has previously responded to a ping from us.
|
|
6857
6851
|
this.serviceWorkerReceiverAvailable
|
|
6858
|
-
? 800 /* LONG_ACK */
|
|
6859
|
-
: 50 /* ACK */);
|
|
6852
|
+
? 800 /* _TimeoutDuration.LONG_ACK */
|
|
6853
|
+
: 50 /* _TimeoutDuration.ACK */);
|
|
6860
6854
|
}
|
|
6861
6855
|
catch (_a) {
|
|
6862
6856
|
// This is a best effort approach. Ignore errors.
|
|
@@ -7002,10 +6996,10 @@ const indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
|
7002
6996
|
* limitations under the License.
|
|
7003
6997
|
*/
|
|
7004
6998
|
function startSignInPhoneMfa(auth, request) {
|
|
7005
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:start" /* START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
6999
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:start" /* Endpoint.START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7006
7000
|
}
|
|
7007
7001
|
function finalizeSignInPhoneMfa(auth, request) {
|
|
7008
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:finalize" /* FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7002
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7009
7003
|
}
|
|
7010
7004
|
|
|
7011
7005
|
/**
|
|
@@ -7025,7 +7019,7 @@ function finalizeSignInPhoneMfa(auth, request) {
|
|
|
7025
7019
|
* limitations under the License.
|
|
7026
7020
|
*/
|
|
7027
7021
|
async function getRecaptchaParams(auth) {
|
|
7028
|
-
return ((await _performApiRequest(auth, "GET" /* GET */, "/v1/recaptchaParams" /* GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || '');
|
|
7022
|
+
return ((await _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)).recaptchaSiteKey || '');
|
|
7029
7023
|
}
|
|
7030
7024
|
|
|
7031
7025
|
/**
|
|
@@ -7055,7 +7049,7 @@ function _loadJS(url) {
|
|
|
7055
7049
|
el.setAttribute('src', url);
|
|
7056
7050
|
el.onload = resolve;
|
|
7057
7051
|
el.onerror = e => {
|
|
7058
|
-
const error = _createError("internal-error" /* INTERNAL_ERROR */);
|
|
7052
|
+
const error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7059
7053
|
error.customData = e;
|
|
7060
7054
|
reject(error);
|
|
7061
7055
|
};
|
|
@@ -7129,7 +7123,7 @@ class MockWidget {
|
|
|
7129
7123
|
const container = typeof containerOrId === 'string'
|
|
7130
7124
|
? document.getElementById(containerOrId)
|
|
7131
7125
|
: containerOrId;
|
|
7132
|
-
_assert(container, "argument-error" /* ARGUMENT_ERROR */, { appName });
|
|
7126
|
+
_assert(container, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, { appName });
|
|
7133
7127
|
this.container = container;
|
|
7134
7128
|
this.isVisible = this.params.size !== 'invisible';
|
|
7135
7129
|
if (this.isVisible) {
|
|
@@ -7233,20 +7227,20 @@ class ReCaptchaLoaderImpl {
|
|
|
7233
7227
|
this.librarySeparatelyLoaded = !!((_a = _window().grecaptcha) === null || _a === void 0 ? void 0 : _a.render);
|
|
7234
7228
|
}
|
|
7235
7229
|
load(auth, hl = '') {
|
|
7236
|
-
_assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7230
|
+
_assert(isHostLanguageValid(hl), auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7237
7231
|
if (this.shouldResolveImmediately(hl)) {
|
|
7238
7232
|
return Promise.resolve(_window().grecaptcha);
|
|
7239
7233
|
}
|
|
7240
7234
|
return new Promise((resolve, reject) => {
|
|
7241
7235
|
const networkTimeout = _window().setTimeout(() => {
|
|
7242
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
7236
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
7243
7237
|
}, NETWORK_TIMEOUT_DELAY.get());
|
|
7244
7238
|
_window()[_JSLOAD_CALLBACK] = () => {
|
|
7245
7239
|
_window().clearTimeout(networkTimeout);
|
|
7246
7240
|
delete _window()[_JSLOAD_CALLBACK];
|
|
7247
7241
|
const recaptcha = _window().grecaptcha;
|
|
7248
7242
|
if (!recaptcha) {
|
|
7249
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
7243
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
7250
7244
|
return;
|
|
7251
7245
|
}
|
|
7252
7246
|
// Wrap the greptcha render function so that we know if the developer has
|
|
@@ -7267,7 +7261,7 @@ class ReCaptchaLoaderImpl {
|
|
|
7267
7261
|
})}`;
|
|
7268
7262
|
_loadJS(url).catch(() => {
|
|
7269
7263
|
clearTimeout(networkTimeout);
|
|
7270
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
7264
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
7271
7265
|
});
|
|
7272
7266
|
});
|
|
7273
7267
|
}
|
|
@@ -7362,11 +7356,11 @@ class RecaptchaVerifier {
|
|
|
7362
7356
|
this.recaptcha = null;
|
|
7363
7357
|
this.auth = _castAuth(authExtern);
|
|
7364
7358
|
this.isInvisible = this.parameters.size === 'invisible';
|
|
7365
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
7359
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
7366
7360
|
const container = typeof containerOrId === 'string'
|
|
7367
7361
|
? document.getElementById(containerOrId)
|
|
7368
7362
|
: containerOrId;
|
|
7369
|
-
_assert(container, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7363
|
+
_assert(container, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7370
7364
|
this.container = container;
|
|
7371
7365
|
this.parameters.callback = this.makeTokenCallback(this.parameters.callback);
|
|
7372
7366
|
this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting
|
|
@@ -7447,9 +7441,9 @@ class RecaptchaVerifier {
|
|
|
7447
7441
|
}
|
|
7448
7442
|
}
|
|
7449
7443
|
validateStartingState() {
|
|
7450
|
-
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7451
|
-
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7452
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
7444
|
+
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7445
|
+
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7446
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
7453
7447
|
}
|
|
7454
7448
|
makeTokenCallback(existing) {
|
|
7455
7449
|
return token => {
|
|
@@ -7466,7 +7460,7 @@ class RecaptchaVerifier {
|
|
|
7466
7460
|
};
|
|
7467
7461
|
}
|
|
7468
7462
|
assertNotDestroyed() {
|
|
7469
|
-
_assert(!this.destroyed, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7463
|
+
_assert(!this.destroyed, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7470
7464
|
}
|
|
7471
7465
|
async makeRenderPromise() {
|
|
7472
7466
|
await this.init();
|
|
@@ -7482,15 +7476,15 @@ class RecaptchaVerifier {
|
|
|
7482
7476
|
return this.widgetId;
|
|
7483
7477
|
}
|
|
7484
7478
|
async init() {
|
|
7485
|
-
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7479
|
+
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7486
7480
|
await domReady();
|
|
7487
7481
|
this.recaptcha = await this._recaptchaLoader.load(this.auth, this.auth.languageCode || undefined);
|
|
7488
7482
|
const siteKey = await getRecaptchaParams(this.auth);
|
|
7489
|
-
_assert(siteKey, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7483
|
+
_assert(siteKey, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7490
7484
|
this.parameters.sitekey = siteKey;
|
|
7491
7485
|
}
|
|
7492
7486
|
getAssertedRecaptcha() {
|
|
7493
|
-
_assert(this.recaptcha, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7487
|
+
_assert(this.recaptcha, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7494
7488
|
return this.recaptcha;
|
|
7495
7489
|
}
|
|
7496
7490
|
}
|
|
@@ -7586,7 +7580,7 @@ async function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
|
|
|
7586
7580
|
*/
|
|
7587
7581
|
async function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
7588
7582
|
const userInternal = getModularInstance(user);
|
|
7589
|
-
await _assertLinkedStatus(false, userInternal, "phone" /* PHONE */);
|
|
7583
|
+
await _assertLinkedStatus(false, userInternal, "phone" /* ProviderId.PHONE */);
|
|
7590
7584
|
const verificationId = await _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier));
|
|
7591
7585
|
return new ConfirmationResultImpl(verificationId, cred => linkWithCredential(userInternal, cred));
|
|
7592
7586
|
}
|
|
@@ -7614,8 +7608,8 @@ async function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
7614
7608
|
var _a;
|
|
7615
7609
|
const recaptchaToken = await verifier.verify();
|
|
7616
7610
|
try {
|
|
7617
|
-
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7618
|
-
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7611
|
+
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7612
|
+
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7619
7613
|
let phoneInfoOptions;
|
|
7620
7614
|
if (typeof options === 'string') {
|
|
7621
7615
|
phoneInfoOptions = {
|
|
@@ -7628,7 +7622,7 @@ async function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
7628
7622
|
if ('session' in phoneInfoOptions) {
|
|
7629
7623
|
const session = phoneInfoOptions.session;
|
|
7630
7624
|
if ('phoneNumber' in phoneInfoOptions) {
|
|
7631
|
-
_assert(session.type === "enroll" /* ENROLL */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7625
|
+
_assert(session.type === "enroll" /* MultiFactorSessionType.ENROLL */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7632
7626
|
const response = await startEnrollPhoneMfa(auth, {
|
|
7633
7627
|
idToken: session.credential,
|
|
7634
7628
|
phoneEnrollmentInfo: {
|
|
@@ -7639,10 +7633,10 @@ async function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
7639
7633
|
return response.phoneSessionInfo.sessionInfo;
|
|
7640
7634
|
}
|
|
7641
7635
|
else {
|
|
7642
|
-
_assert(session.type === "signin" /* SIGN_IN */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7636
|
+
_assert(session.type === "signin" /* MultiFactorSessionType.SIGN_IN */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7643
7637
|
const mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||
|
|
7644
7638
|
phoneInfoOptions.multiFactorUid;
|
|
7645
|
-
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* MISSING_MFA_INFO */);
|
|
7639
|
+
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */);
|
|
7646
7640
|
const response = await startSignInPhoneMfa(auth, {
|
|
7647
7641
|
mfaPendingCredential: session.credential,
|
|
7648
7642
|
mfaEnrollmentId,
|
|
@@ -7849,9 +7843,9 @@ class PhoneAuthProvider {
|
|
|
7849
7843
|
}
|
|
7850
7844
|
}
|
|
7851
7845
|
/** Always set to {@link ProviderId}.PHONE. */
|
|
7852
|
-
PhoneAuthProvider.PROVIDER_ID = "phone" /* PHONE */;
|
|
7846
|
+
PhoneAuthProvider.PROVIDER_ID = "phone" /* ProviderId.PHONE */;
|
|
7853
7847
|
/** Always set to {@link SignInMethod}.PHONE. */
|
|
7854
|
-
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* PHONE */;
|
|
7848
|
+
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* SignInMethod.PHONE */;
|
|
7855
7849
|
|
|
7856
7850
|
/**
|
|
7857
7851
|
* @license
|
|
@@ -7878,7 +7872,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
7878
7872
|
if (resolverOverride) {
|
|
7879
7873
|
return _getInstance(resolverOverride);
|
|
7880
7874
|
}
|
|
7881
|
-
_assert(auth._popupRedirectResolver, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7875
|
+
_assert(auth._popupRedirectResolver, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7882
7876
|
return auth._popupRedirectResolver;
|
|
7883
7877
|
}
|
|
7884
7878
|
|
|
@@ -7900,7 +7894,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
7900
7894
|
*/
|
|
7901
7895
|
class IdpCredential extends AuthCredential {
|
|
7902
7896
|
constructor(params) {
|
|
7903
|
-
super("custom" /* CUSTOM */, "custom" /* CUSTOM */);
|
|
7897
|
+
super("custom" /* ProviderId.CUSTOM */, "custom" /* ProviderId.CUSTOM */);
|
|
7904
7898
|
this.params = params;
|
|
7905
7899
|
}
|
|
7906
7900
|
_getIdTokenResponse(auth) {
|
|
@@ -7933,12 +7927,12 @@ function _signIn(params) {
|
|
|
7933
7927
|
}
|
|
7934
7928
|
function _reauth(params) {
|
|
7935
7929
|
const { auth, user } = params;
|
|
7936
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7930
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7937
7931
|
return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
|
|
7938
7932
|
}
|
|
7939
7933
|
async function _link(params) {
|
|
7940
7934
|
const { auth, user } = params;
|
|
7941
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7935
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7942
7936
|
return _link$1(user, new IdpCredential(params), params.bypassAuthState);
|
|
7943
7937
|
}
|
|
7944
7938
|
|
|
@@ -8012,17 +8006,17 @@ class AbstractPopupRedirectOperation {
|
|
|
8012
8006
|
}
|
|
8013
8007
|
getIdpTask(type) {
|
|
8014
8008
|
switch (type) {
|
|
8015
|
-
case "signInViaPopup" /* SIGN_IN_VIA_POPUP */:
|
|
8016
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
8009
|
+
case "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */:
|
|
8010
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
8017
8011
|
return _signIn;
|
|
8018
|
-
case "linkViaPopup" /* LINK_VIA_POPUP */:
|
|
8019
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
8012
|
+
case "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */:
|
|
8013
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
8020
8014
|
return _link;
|
|
8021
|
-
case "reauthViaPopup" /* REAUTH_VIA_POPUP */:
|
|
8022
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
8015
|
+
case "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */:
|
|
8016
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
8023
8017
|
return _reauth;
|
|
8024
8018
|
default:
|
|
8025
|
-
_fail(this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8019
|
+
_fail(this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8026
8020
|
}
|
|
8027
8021
|
}
|
|
8028
8022
|
resolve(cred) {
|
|
@@ -8094,7 +8088,7 @@ async function signInWithPopup(auth, provider, resolver) {
|
|
|
8094
8088
|
const authInternal = _castAuth(auth);
|
|
8095
8089
|
_assertInstanceOf(auth, provider, FederatedAuthProvider);
|
|
8096
8090
|
const resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
8097
|
-
const action = new PopupOperation(authInternal, "signInViaPopup" /* SIGN_IN_VIA_POPUP */, provider, resolverInternal);
|
|
8091
|
+
const action = new PopupOperation(authInternal, "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */, provider, resolverInternal);
|
|
8098
8092
|
return action.executeNotNull();
|
|
8099
8093
|
}
|
|
8100
8094
|
/**
|
|
@@ -8126,7 +8120,7 @@ async function reauthenticateWithPopup(user, provider, resolver) {
|
|
|
8126
8120
|
const userInternal = getModularInstance(user);
|
|
8127
8121
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
8128
8122
|
const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
8129
|
-
const action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
8123
|
+
const action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
8130
8124
|
return action.executeNotNull();
|
|
8131
8125
|
}
|
|
8132
8126
|
/**
|
|
@@ -8157,7 +8151,7 @@ async function linkWithPopup(user, provider, resolver) {
|
|
|
8157
8151
|
const userInternal = getModularInstance(user);
|
|
8158
8152
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
8159
8153
|
const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
8160
|
-
const action = new PopupOperation(userInternal.auth, "linkViaPopup" /* LINK_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
8154
|
+
const action = new PopupOperation(userInternal.auth, "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
8161
8155
|
return action.executeNotNull();
|
|
8162
8156
|
}
|
|
8163
8157
|
/**
|
|
@@ -8178,7 +8172,7 @@ class PopupOperation extends AbstractPopupRedirectOperation {
|
|
|
8178
8172
|
}
|
|
8179
8173
|
async executeNotNull() {
|
|
8180
8174
|
const result = await this.execute();
|
|
8181
|
-
_assert(result, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8175
|
+
_assert(result, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8182
8176
|
return result;
|
|
8183
8177
|
}
|
|
8184
8178
|
async onExecution() {
|
|
@@ -8199,7 +8193,7 @@ class PopupOperation extends AbstractPopupRedirectOperation {
|
|
|
8199
8193
|
});
|
|
8200
8194
|
this.resolver._isIframeWebStorageSupported(this.auth, isSupported => {
|
|
8201
8195
|
if (!isSupported) {
|
|
8202
|
-
this.reject(_createError(this.auth, "web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */));
|
|
8196
|
+
this.reject(_createError(this.auth, "web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */));
|
|
8203
8197
|
}
|
|
8204
8198
|
});
|
|
8205
8199
|
// Handle user closure. Notice this does *not* use await
|
|
@@ -8210,7 +8204,7 @@ class PopupOperation extends AbstractPopupRedirectOperation {
|
|
|
8210
8204
|
return ((_a = this.authWindow) === null || _a === void 0 ? void 0 : _a.associatedEvent) || null;
|
|
8211
8205
|
}
|
|
8212
8206
|
cancel() {
|
|
8213
|
-
this.reject(_createError(this.auth, "cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */));
|
|
8207
|
+
this.reject(_createError(this.auth, "cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */));
|
|
8214
8208
|
}
|
|
8215
8209
|
cleanUp() {
|
|
8216
8210
|
if (this.authWindow) {
|
|
@@ -8232,8 +8226,8 @@ class PopupOperation extends AbstractPopupRedirectOperation {
|
|
|
8232
8226
|
// call could still be in flight.
|
|
8233
8227
|
this.pollId = window.setTimeout(() => {
|
|
8234
8228
|
this.pollId = null;
|
|
8235
|
-
this.reject(_createError(this.auth, "popup-closed-by-user" /* POPUP_CLOSED_BY_USER */));
|
|
8236
|
-
}, 2000 /* AUTH_EVENT */);
|
|
8229
|
+
this.reject(_createError(this.auth, "popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */));
|
|
8230
|
+
}, 2000 /* _Timeout.AUTH_EVENT */);
|
|
8237
8231
|
return;
|
|
8238
8232
|
}
|
|
8239
8233
|
this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());
|
|
@@ -8268,10 +8262,10 @@ const redirectOutcomeMap = new Map();
|
|
|
8268
8262
|
class RedirectAction extends AbstractPopupRedirectOperation {
|
|
8269
8263
|
constructor(auth, resolver, bypassAuthState = false) {
|
|
8270
8264
|
super(auth, [
|
|
8271
|
-
"signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */,
|
|
8272
|
-
"linkViaRedirect" /* LINK_VIA_REDIRECT */,
|
|
8273
|
-
"reauthViaRedirect" /* REAUTH_VIA_REDIRECT */,
|
|
8274
|
-
"unknown" /* UNKNOWN */
|
|
8265
|
+
"signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */,
|
|
8266
|
+
"linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */,
|
|
8267
|
+
"reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */,
|
|
8268
|
+
"unknown" /* AuthEventType.UNKNOWN */
|
|
8275
8269
|
], resolver, undefined, bypassAuthState);
|
|
8276
8270
|
this.eventId = null;
|
|
8277
8271
|
}
|
|
@@ -8300,10 +8294,10 @@ class RedirectAction extends AbstractPopupRedirectOperation {
|
|
|
8300
8294
|
return readyOutcome();
|
|
8301
8295
|
}
|
|
8302
8296
|
async onAuthEvent(event) {
|
|
8303
|
-
if (event.type === "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */) {
|
|
8297
|
+
if (event.type === "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */) {
|
|
8304
8298
|
return super.onAuthEvent(event);
|
|
8305
8299
|
}
|
|
8306
|
-
else if (event.type === "unknown" /* UNKNOWN */) {
|
|
8300
|
+
else if (event.type === "unknown" /* AuthEventType.UNKNOWN */) {
|
|
8307
8301
|
// This is a sentinel value indicating there's no pending redirect
|
|
8308
8302
|
this.resolve(null);
|
|
8309
8303
|
return;
|
|
@@ -8411,7 +8405,7 @@ async function _signInWithRedirect(auth, provider, resolver) {
|
|
|
8411
8405
|
_assertInstanceOf(auth, provider, FederatedAuthProvider);
|
|
8412
8406
|
const resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
8413
8407
|
await _setPendingRedirectStatus(resolverInternal, authInternal);
|
|
8414
|
-
return resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */);
|
|
8408
|
+
return resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */);
|
|
8415
8409
|
}
|
|
8416
8410
|
/**
|
|
8417
8411
|
* Reauthenticates the current user with the specified {@link OAuthProvider} using a full-page redirect flow.
|
|
@@ -8451,7 +8445,7 @@ async function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
8451
8445
|
const resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
8452
8446
|
await _setPendingRedirectStatus(resolverInternal, userInternal.auth);
|
|
8453
8447
|
const eventId = await prepareUserForRedirect(userInternal);
|
|
8454
|
-
return resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */, eventId);
|
|
8448
|
+
return resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId);
|
|
8455
8449
|
}
|
|
8456
8450
|
/**
|
|
8457
8451
|
* Links the {@link OAuthProvider} to the user account using a full-page redirect flow.
|
|
@@ -8489,7 +8483,7 @@ async function _linkWithRedirect(user, provider, resolver) {
|
|
|
8489
8483
|
await _assertLinkedStatus(false, userInternal, provider.providerId);
|
|
8490
8484
|
await _setPendingRedirectStatus(resolverInternal, userInternal.auth);
|
|
8491
8485
|
const eventId = await prepareUserForRedirect(userInternal);
|
|
8492
|
-
return resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* LINK_VIA_REDIRECT */, eventId);
|
|
8486
|
+
return resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId);
|
|
8493
8487
|
}
|
|
8494
8488
|
/**
|
|
8495
8489
|
* Returns a {@link UserCredential} from the redirect-based sign-in flow.
|
|
@@ -8623,7 +8617,7 @@ class AuthEventManager {
|
|
|
8623
8617
|
var _a;
|
|
8624
8618
|
if (event.error && !isNullRedirectEvent(event)) {
|
|
8625
8619
|
const code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
|
|
8626
|
-
"internal-error" /* INTERNAL_ERROR */;
|
|
8620
|
+
"internal-error" /* AuthErrorCode.INTERNAL_ERROR */;
|
|
8627
8621
|
consumer.onError(_createError(this.auth, code));
|
|
8628
8622
|
}
|
|
8629
8623
|
else {
|
|
@@ -8651,16 +8645,16 @@ function eventUid(e) {
|
|
|
8651
8645
|
return [e.type, e.eventId, e.sessionId, e.tenantId].filter(v => v).join('-');
|
|
8652
8646
|
}
|
|
8653
8647
|
function isNullRedirectEvent({ type, error }) {
|
|
8654
|
-
return (type === "unknown" /* UNKNOWN */ &&
|
|
8655
|
-
(error === null || error === void 0 ? void 0 : error.code) === `auth/${"no-auth-event" /* NO_AUTH_EVENT */}`);
|
|
8648
|
+
return (type === "unknown" /* AuthEventType.UNKNOWN */ &&
|
|
8649
|
+
(error === null || error === void 0 ? void 0 : error.code) === `auth/${"no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */}`);
|
|
8656
8650
|
}
|
|
8657
8651
|
function isRedirectEvent(event) {
|
|
8658
8652
|
switch (event.type) {
|
|
8659
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
8660
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
8661
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
8653
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
8654
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
8655
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
8662
8656
|
return true;
|
|
8663
|
-
case "unknown" /* UNKNOWN */:
|
|
8657
|
+
case "unknown" /* AuthEventType.UNKNOWN */:
|
|
8664
8658
|
return isNullRedirectEvent(event);
|
|
8665
8659
|
default:
|
|
8666
8660
|
return false;
|
|
@@ -8684,7 +8678,7 @@ function isRedirectEvent(event) {
|
|
|
8684
8678
|
* limitations under the License.
|
|
8685
8679
|
*/
|
|
8686
8680
|
async function _getProjectConfig(auth, request = {}) {
|
|
8687
|
-
return _performApiRequest(auth, "GET" /* GET */, "/v1/projects" /* GET_PROJECT_CONFIG */, request);
|
|
8681
|
+
return _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/projects" /* Endpoint.GET_PROJECT_CONFIG */, request);
|
|
8688
8682
|
}
|
|
8689
8683
|
|
|
8690
8684
|
/**
|
|
@@ -8722,7 +8716,7 @@ async function _validateOrigin(auth) {
|
|
|
8722
8716
|
}
|
|
8723
8717
|
}
|
|
8724
8718
|
// In the old SDK, this error also provides helpful messages.
|
|
8725
|
-
_fail(auth, "unauthorized-domain" /* INVALID_ORIGIN */);
|
|
8719
|
+
_fail(auth, "unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */);
|
|
8726
8720
|
}
|
|
8727
8721
|
function matchDomain(expected) {
|
|
8728
8722
|
const currentUrl = _getCurrentUrl();
|
|
@@ -8819,7 +8813,7 @@ function loadGapi(auth) {
|
|
|
8819
8813
|
// failed attempt.
|
|
8820
8814
|
// Timeout when gapi.iframes.Iframe not loaded.
|
|
8821
8815
|
resetUnloadedGapiModules();
|
|
8822
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
8816
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
8823
8817
|
},
|
|
8824
8818
|
timeout: NETWORK_TIMEOUT.get()
|
|
8825
8819
|
});
|
|
@@ -8847,7 +8841,7 @@ function loadGapi(auth) {
|
|
|
8847
8841
|
}
|
|
8848
8842
|
else {
|
|
8849
8843
|
// Gapi loader failed, throw error.
|
|
8850
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
8844
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
8851
8845
|
}
|
|
8852
8846
|
};
|
|
8853
8847
|
// Load GApi loader.
|
|
@@ -8898,13 +8892,13 @@ const IFRAME_ATTRIBUTES = {
|
|
|
8898
8892
|
// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to
|
|
8899
8893
|
// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.
|
|
8900
8894
|
const EID_FROM_APIHOST = new Map([
|
|
8901
|
-
["identitytoolkit.googleapis.com" /* API_HOST */, 'p'],
|
|
8895
|
+
["identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */, 'p'],
|
|
8902
8896
|
['staging-identitytoolkit.sandbox.googleapis.com', 's'],
|
|
8903
8897
|
['test-identitytoolkit.sandbox.googleapis.com', 't'] // test
|
|
8904
8898
|
]);
|
|
8905
8899
|
function getIframeUrl(auth) {
|
|
8906
8900
|
const config = auth.config;
|
|
8907
|
-
_assert(config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
8901
|
+
_assert(config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
8908
8902
|
const url = config.emulator
|
|
8909
8903
|
? _emulatorUrl(config, EMULATED_IFRAME_PATH)
|
|
8910
8904
|
: `https://${auth.config.authDomain}/${IFRAME_PATH}`;
|
|
@@ -8926,7 +8920,7 @@ function getIframeUrl(auth) {
|
|
|
8926
8920
|
async function _openIframe(auth) {
|
|
8927
8921
|
const context = await _loadGapi(auth);
|
|
8928
8922
|
const gapi = _window().gapi;
|
|
8929
|
-
_assert(gapi, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8923
|
+
_assert(gapi, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8930
8924
|
return context.open({
|
|
8931
8925
|
where: document.body,
|
|
8932
8926
|
url: getIframeUrl(auth),
|
|
@@ -8938,7 +8932,7 @@ async function _openIframe(auth) {
|
|
|
8938
8932
|
// Prevent iframe from closing on mouse out.
|
|
8939
8933
|
setHideOnLeave: false
|
|
8940
8934
|
});
|
|
8941
|
-
const networkError = _createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
8935
|
+
const networkError = _createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
8942
8936
|
// Confirm iframe is correctly loaded.
|
|
8943
8937
|
// To fallback on failure, set a timeout.
|
|
8944
8938
|
const networkErrorTimer = _window().setTimeout(() => {
|
|
@@ -9024,7 +9018,7 @@ function _open(auth, url, name, width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT)
|
|
|
9024
9018
|
// about:blank getting sanitized causing browsers like IE/Edge to display
|
|
9025
9019
|
// brief error message before redirecting to handler.
|
|
9026
9020
|
const newWin = window.open(url || '', target, optionsString);
|
|
9027
|
-
_assert(newWin, auth, "popup-blocked" /* POPUP_BLOCKED */);
|
|
9021
|
+
_assert(newWin, auth, "popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */);
|
|
9028
9022
|
// Flaky on IE edge, encapsulate with a try and catch.
|
|
9029
9023
|
try {
|
|
9030
9024
|
newWin.focus();
|
|
@@ -9070,8 +9064,8 @@ const WIDGET_PATH = '__/auth/handler';
|
|
|
9070
9064
|
*/
|
|
9071
9065
|
const EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
|
|
9072
9066
|
function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
|
|
9073
|
-
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
9074
|
-
_assert(auth.config.apiKey, auth, "invalid-api-key" /* INVALID_API_KEY */);
|
|
9067
|
+
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
9068
|
+
_assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
|
|
9075
9069
|
const params = {
|
|
9076
9070
|
apiKey: auth.config.apiKey,
|
|
9077
9071
|
appName: auth.name,
|
|
@@ -9185,10 +9179,10 @@ class BrowserPopupRedirectResolver {
|
|
|
9185
9179
|
const iframe = await _openIframe(auth);
|
|
9186
9180
|
const manager = new AuthEventManager(auth);
|
|
9187
9181
|
iframe.register('authEvent', (iframeEvent) => {
|
|
9188
|
-
_assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" /* INVALID_AUTH_EVENT */);
|
|
9182
|
+
_assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */);
|
|
9189
9183
|
// TODO: Consider splitting redirect and popup events earlier on
|
|
9190
9184
|
const handled = manager.onEvent(iframeEvent.authEvent);
|
|
9191
|
-
return { status: handled ? "ACK" /* ACK */ : "ERROR" /* ERROR */ };
|
|
9185
|
+
return { status: handled ? "ACK" /* GapiOutcome.ACK */ : "ERROR" /* GapiOutcome.ERROR */ };
|
|
9192
9186
|
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
9193
9187
|
this.eventManagers[auth._key()] = { manager };
|
|
9194
9188
|
this.iframes[auth._key()] = iframe;
|
|
@@ -9202,7 +9196,7 @@ class BrowserPopupRedirectResolver {
|
|
|
9202
9196
|
if (isSupported !== undefined) {
|
|
9203
9197
|
cb(!!isSupported);
|
|
9204
9198
|
}
|
|
9205
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9199
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9206
9200
|
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
9207
9201
|
}
|
|
9208
9202
|
_originValidation(auth) {
|
|
@@ -9231,9 +9225,9 @@ class MultiFactorAssertionImpl {
|
|
|
9231
9225
|
}
|
|
9232
9226
|
_process(auth, session, displayName) {
|
|
9233
9227
|
switch (session.type) {
|
|
9234
|
-
case "enroll" /* ENROLL */:
|
|
9228
|
+
case "enroll" /* MultiFactorSessionType.ENROLL */:
|
|
9235
9229
|
return this._finalizeEnroll(auth, session.credential, displayName);
|
|
9236
|
-
case "signin" /* SIGN_IN */:
|
|
9230
|
+
case "signin" /* MultiFactorSessionType.SIGN_IN */:
|
|
9237
9231
|
return this._finalizeSignIn(auth, session.credential);
|
|
9238
9232
|
default:
|
|
9239
9233
|
return debugFail('unexpected MultiFactorSessionType');
|
|
@@ -9248,7 +9242,7 @@ class MultiFactorAssertionImpl {
|
|
|
9248
9242
|
*/
|
|
9249
9243
|
class PhoneMultiFactorAssertionImpl extends MultiFactorAssertionImpl {
|
|
9250
9244
|
constructor(credential) {
|
|
9251
|
-
super("phone" /* PHONE */);
|
|
9245
|
+
super("phone" /* FactorId.PHONE */);
|
|
9252
9246
|
this.credential = credential;
|
|
9253
9247
|
}
|
|
9254
9248
|
/** @internal */
|
|
@@ -9295,7 +9289,7 @@ class PhoneMultiFactorGenerator {
|
|
|
9295
9289
|
PhoneMultiFactorGenerator.FACTOR_ID = 'phone';
|
|
9296
9290
|
|
|
9297
9291
|
var name = "@firebase/auth";
|
|
9298
|
-
var version = "0.
|
|
9292
|
+
var version = "0.21.0";
|
|
9299
9293
|
|
|
9300
9294
|
/**
|
|
9301
9295
|
* @license
|
|
@@ -9338,8 +9332,7 @@ class AuthInterop {
|
|
|
9338
9332
|
return;
|
|
9339
9333
|
}
|
|
9340
9334
|
const unsubscribe = this.auth.onIdTokenChanged(user => {
|
|
9341
|
-
|
|
9342
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
9335
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
9343
9336
|
});
|
|
9344
9337
|
this.internalListeners.set(listener, unsubscribe);
|
|
9345
9338
|
this.updateProactiveRefresh();
|
|
@@ -9355,7 +9348,7 @@ class AuthInterop {
|
|
|
9355
9348
|
this.updateProactiveRefresh();
|
|
9356
9349
|
}
|
|
9357
9350
|
assertAuthConfigured() {
|
|
9358
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
9351
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
9359
9352
|
}
|
|
9360
9353
|
updateProactiveRefresh() {
|
|
9361
9354
|
if (this.internalListeners.size > 0) {
|
|
@@ -9385,13 +9378,13 @@ class AuthInterop {
|
|
|
9385
9378
|
*/
|
|
9386
9379
|
function getVersionForPlatform(clientPlatform) {
|
|
9387
9380
|
switch (clientPlatform) {
|
|
9388
|
-
case "Node" /* NODE */:
|
|
9381
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
9389
9382
|
return 'node';
|
|
9390
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
9383
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
9391
9384
|
return 'rn';
|
|
9392
|
-
case "Worker" /* WORKER */:
|
|
9385
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
9393
9386
|
return 'webworker';
|
|
9394
|
-
case "Cordova" /* CORDOVA */:
|
|
9387
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
9395
9388
|
return 'cordova';
|
|
9396
9389
|
default:
|
|
9397
9390
|
return undefined;
|
|
@@ -9399,47 +9392,47 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
9399
9392
|
}
|
|
9400
9393
|
/** @internal */
|
|
9401
9394
|
function registerAuth(clientPlatform) {
|
|
9402
|
-
_registerComponent(new Component("auth" /* AUTH */, (container, { options: deps }) => {
|
|
9395
|
+
_registerComponent(new Component("auth" /* _ComponentName.AUTH */, (container, { options: deps }) => {
|
|
9403
9396
|
const app = container.getProvider('app').getImmediate();
|
|
9404
9397
|
const heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
9405
9398
|
const { apiKey, authDomain } = app.options;
|
|
9406
9399
|
return ((app, heartbeatServiceProvider) => {
|
|
9407
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
9400
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
9408
9401
|
// Auth domain is optional if IdP sign in isn't being used
|
|
9409
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
9402
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
9410
9403
|
appName: app.name
|
|
9411
9404
|
});
|
|
9412
9405
|
const config = {
|
|
9413
9406
|
apiKey,
|
|
9414
9407
|
authDomain,
|
|
9415
9408
|
clientPlatform,
|
|
9416
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
9417
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
9418
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
9409
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
9410
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
9411
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
9419
9412
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
9420
9413
|
};
|
|
9421
9414
|
const authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
9422
9415
|
_initializeAuthInstance(authInstance, deps);
|
|
9423
9416
|
return authInstance;
|
|
9424
9417
|
})(app, heartbeatServiceProvider);
|
|
9425
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
9418
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
9426
9419
|
/**
|
|
9427
9420
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
9428
9421
|
* For why we do this, See go/firebase-next-auth-init
|
|
9429
9422
|
*/
|
|
9430
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
9423
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
9431
9424
|
/**
|
|
9432
9425
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
9433
9426
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
9434
9427
|
*/
|
|
9435
9428
|
.setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => {
|
|
9436
|
-
const authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
9429
|
+
const authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
9437
9430
|
authInternalProvider.initialize();
|
|
9438
9431
|
}));
|
|
9439
|
-
_registerComponent(new Component("auth-internal" /* AUTH_INTERNAL */, container => {
|
|
9440
|
-
const auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
9432
|
+
_registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, container => {
|
|
9433
|
+
const auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
9441
9434
|
return (auth => new AuthInterop(auth))(auth);
|
|
9442
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
9435
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
9443
9436
|
registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
9444
9437
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
9445
9438
|
registerVersion(name, version, 'esm2017');
|
|
@@ -9519,7 +9512,7 @@ function getAuth(app = getApp()) {
|
|
|
9519
9512
|
}
|
|
9520
9513
|
return auth;
|
|
9521
9514
|
}
|
|
9522
|
-
registerAuth("Browser" /* BROWSER */);
|
|
9515
|
+
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
9523
9516
|
|
|
9524
9517
|
export { signInWithCustomToken as $, ActionCodeOperation as A, debugErrorMap as B, prodErrorMap as C, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as D, initializeAuth as E, FactorId as F, connectAuthEmulator as G, AuthCredential as H, EmailAuthCredential as I, OAuthCredential as J, PhoneAuthCredential as K, inMemoryPersistence as L, EmailAuthProvider as M, FacebookAuthProvider as N, OperationType as O, PhoneAuthProvider as P, GoogleAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, GithubAuthProvider as T, OAuthProvider as U, SAMLAuthProvider as V, TwitterAuthProvider as W, signInAnonymously as X, signInWithCredential as Y, linkWithCredential as Z, reauthenticateWithCredential as _, browserSessionPersistence as a, sendPasswordResetEmail as a0, confirmPasswordReset as a1, applyActionCode as a2, checkActionCode as a3, verifyPasswordResetCode as a4, createUserWithEmailAndPassword as a5, signInWithEmailAndPassword as a6, sendSignInLinkToEmail as a7, isSignInWithEmailLink as a8, signInWithEmailLink as a9, _persistenceKeyName as aA, _getRedirectResult as aB, _overrideRedirectResult as aC, _clearRedirectOutcomes as aD, _castAuth as aE, UserImpl as aF, AuthImpl as aG, _getClientVersion as aH, _generateEventId as aI, AuthPopup as aJ, FetchProvider as aK, SAMLAuthCredential as aL, fetchSignInMethodsForEmail as aa, sendEmailVerification as ab, verifyBeforeUpdateEmail as ac, ActionCodeURL as ad, parseActionCodeURL as ae, updateProfile as af, updateEmail as ag, updatePassword as ah, getIdToken as ai, getIdTokenResult as aj, unlink as ak, getAdditionalUserInfo as al, reload as am, getMultiFactorResolver as an, multiFactor as ao, debugAssert as ap, _isIOS as aq, _isAndroid as ar, _fail as as, _getRedirectUrl as at, _getProjectConfig as au, _isIOS7Or8 as av, _createError as aw, _assert as ax, AuthEventManager as ay, _getInstance as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, getAuth as n, ProviderId as o, setPersistence as p, onIdTokenChanged as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, beforeAuthStateChanged as t, updatePhoneNumber as u, onAuthStateChanged as v, useDeviceLanguage as w, updateCurrentUser as x, signOut as y, deleteUser as z };
|
|
9525
|
-
//# sourceMappingURL=index-
|
|
9518
|
+
//# sourceMappingURL=index-c6def6da.js.map
|