@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
|
@@ -144,147 +144,147 @@ var ActionCodeOperation = {
|
|
|
144
144
|
function _debugErrorMap() {
|
|
145
145
|
var _a;
|
|
146
146
|
return _a = {},
|
|
147
|
-
_a["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
148
|
-
_a["argument-error" /* ARGUMENT_ERROR */] = '',
|
|
149
|
-
_a["app-not-authorized" /* APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
147
|
+
_a["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
148
|
+
_a["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */] = '',
|
|
149
|
+
_a["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
150
150
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
151
151
|
'Review your key configuration in the Google API console.',
|
|
152
|
-
_a["app-not-installed" /* APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
152
|
+
_a["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
153
153
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
154
154
|
'this device.',
|
|
155
|
-
_a["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
155
|
+
_a["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
156
156
|
'already used or the domain associated with it does not match the list ' +
|
|
157
157
|
'of whitelisted domains.',
|
|
158
|
-
_a["code-expired" /* CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
158
|
+
_a["code-expired" /* AuthErrorCode.CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
159
159
|
'again.',
|
|
160
|
-
_a["cordova-not-ready" /* CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
161
|
-
_a["cors-unsupported" /* CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
162
|
-
_a["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
163
|
-
_a["custom-token-mismatch" /* CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
164
|
-
_a["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
160
|
+
_a["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
161
|
+
_a["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
162
|
+
_a["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
163
|
+
_a["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
164
|
+
_a["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
165
165
|
'again before retrying this request.',
|
|
166
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
166
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
167
167
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
168
168
|
'starting any other Firebase SDK.',
|
|
169
|
-
_a["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
169
|
+
_a["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
170
170
|
'conditions.',
|
|
171
|
-
_a["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
172
|
-
_a["email-already-in-use" /* EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
173
|
-
_a["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
171
|
+
_a["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
172
|
+
_a["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
173
|
+
_a["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
174
174
|
'no longer be configured to use the emulator. Try calling ' +
|
|
175
175
|
'"connectAuthEmulator()" sooner.',
|
|
176
|
-
_a["expired-action-code" /* EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
177
|
-
_a["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
178
|
-
_a["internal-error" /* INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
179
|
-
_a["invalid-app-credential" /* INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
176
|
+
_a["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
177
|
+
_a["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
178
|
+
_a["internal-error" /* AuthErrorCode.INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
179
|
+
_a["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
180
180
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
181
|
-
_a["invalid-app-id" /* INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
182
|
-
_a["invalid-user-token" /* INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
181
|
+
_a["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
182
|
+
_a["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
183
183
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
184
184
|
'the project associated with this API key.',
|
|
185
|
-
_a["invalid-auth-event" /* INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
186
|
-
_a["invalid-verification-code" /* INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
185
|
+
_a["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
186
|
+
_a["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
187
187
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
188
188
|
'verification code provided by the user.',
|
|
189
|
-
_a["invalid-continue-uri" /* INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
190
|
-
_a["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
189
|
+
_a["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
190
|
+
_a["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
191
191
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
192
192
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
193
193
|
'cordova-plugin-customurlscheme.',
|
|
194
|
-
_a["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
195
|
-
_a["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
196
|
-
_a["invalid-email" /* INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
197
|
-
_a["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
198
|
-
_a["invalid-api-key" /* INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
199
|
-
_a["invalid-cert-hash" /* INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
200
|
-
_a["invalid-credential" /* INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
201
|
-
_a["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
194
|
+
_a["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
195
|
+
_a["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
196
|
+
_a["invalid-email" /* AuthErrorCode.INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
197
|
+
_a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
198
|
+
_a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
199
|
+
_a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
200
|
+
_a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
201
|
+
_a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
202
202
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
203
|
-
_a["invalid-multi-factor-session" /* INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
204
|
-
_a["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
203
|
+
_a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
204
|
+
_a["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
205
205
|
'only supports OAuth providers.',
|
|
206
|
-
_a["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
206
|
+
_a["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
207
207
|
'specified API key.',
|
|
208
|
-
_a["unauthorized-domain" /* INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
208
|
+
_a["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
209
209
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
210
|
-
_a["invalid-action-code" /* INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
210
|
+
_a["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
211
211
|
'expired, or has already been used.',
|
|
212
|
-
_a["wrong-password" /* INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
213
|
-
_a["invalid-persistence-type" /* INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
214
|
-
_a["invalid-phone-number" /* INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
212
|
+
_a["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
213
|
+
_a["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
214
|
+
_a["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
215
215
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
216
216
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
217
217
|
'number including area code].',
|
|
218
|
-
_a["invalid-provider-id" /* INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
219
|
-
_a["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
218
|
+
_a["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
219
|
+
_a["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
220
220
|
'recipient email address is invalid.',
|
|
221
|
-
_a["invalid-sender" /* INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
221
|
+
_a["invalid-sender" /* AuthErrorCode.INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
222
222
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
223
|
-
_a["invalid-verification-id" /* INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
224
|
-
_a["invalid-tenant-id" /* INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
225
|
-
_a["login-blocked" /* LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
226
|
-
_a["missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
227
|
-
_a["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
223
|
+
_a["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
224
|
+
_a["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
225
|
+
_a["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
226
|
+
_a["missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
227
|
+
_a["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
228
228
|
'by following the instructions in the Firebase console.',
|
|
229
|
-
_a["missing-app-credential" /* MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
229
|
+
_a["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
230
230
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
231
|
-
_a["missing-verification-code" /* MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
232
|
-
_a["missing-continue-uri" /* MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
233
|
-
_a["missing-iframe-start" /* MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
234
|
-
_a["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
235
|
-
_a["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
231
|
+
_a["missing-verification-code" /* AuthErrorCode.MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
232
|
+
_a["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
233
|
+
_a["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
234
|
+
_a["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
235
|
+
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
236
236
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
237
237
|
'in the ID token payload.',
|
|
238
|
-
_a["missing-multi-factor-info" /* MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
239
|
-
_a["missing-multi-factor-session" /* MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
240
|
-
_a["missing-phone-number" /* MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
241
|
-
_a["missing-verification-id" /* MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
242
|
-
_a["app-deleted" /* MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
243
|
-
_a["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
244
|
-
_a["multi-factor-auth-required" /* MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
245
|
-
_a["account-exists-with-different-credential" /* NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
238
|
+
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
239
|
+
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
240
|
+
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
241
|
+
_a["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
242
|
+
_a["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
243
|
+
_a["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
244
|
+
_a["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
245
|
+
_a["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
246
246
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
247
247
|
'email address.',
|
|
248
|
-
_a["network-request-failed" /* NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
249
|
-
_a["no-auth-event" /* NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
250
|
-
_a["no-such-provider" /* NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
251
|
-
_a["null-user" /* NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
248
|
+
_a["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
249
|
+
_a["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
250
|
+
_a["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
251
|
+
_a["null-user" /* AuthErrorCode.NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
252
252
|
'requires a non-null user object.',
|
|
253
|
-
_a["operation-not-allowed" /* OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
253
|
+
_a["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
254
254
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
255
255
|
'Auth section.',
|
|
256
|
-
_a["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
256
|
+
_a["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
257
257
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
258
258
|
' and web storage must be enabled.',
|
|
259
|
-
_a["popup-blocked" /* POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
260
|
-
_a["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
261
|
-
_a["provider-already-linked" /* PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
262
|
-
_a["quota-exceeded" /* QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
263
|
-
_a["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
264
|
-
_a["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
265
|
-
_a["rejected-credential" /* REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
266
|
-
_a["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
267
|
-
_a["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
268
|
-
_a["tenant-id-mismatch" /* TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
269
|
-
_a["timeout" /* TIMEOUT */] = 'The operation has timed out.',
|
|
270
|
-
_a["user-token-expired" /* TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
271
|
-
_a["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
259
|
+
_a["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
260
|
+
_a["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
261
|
+
_a["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
262
|
+
_a["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
263
|
+
_a["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
264
|
+
_a["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
265
|
+
_a["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
266
|
+
_a["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
267
|
+
_a["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
268
|
+
_a["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
269
|
+
_a["timeout" /* AuthErrorCode.TIMEOUT */] = 'The operation has timed out.',
|
|
270
|
+
_a["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
271
|
+
_a["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
272
272
|
'Try again later.',
|
|
273
|
-
_a["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
273
|
+
_a["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
274
274
|
'the domain in the Firebase console.',
|
|
275
|
-
_a["unsupported-first-factor" /* UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
276
|
-
_a["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
277
|
-
_a["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
278
|
-
_a["unverified-email" /* UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
279
|
-
_a["user-cancelled" /* USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
280
|
-
_a["user-not-found" /* USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
275
|
+
_a["unsupported-first-factor" /* AuthErrorCode.UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
276
|
+
_a["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
277
|
+
_a["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
278
|
+
_a["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
279
|
+
_a["user-cancelled" /* AuthErrorCode.USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
280
|
+
_a["user-not-found" /* AuthErrorCode.USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
281
281
|
'have been deleted.',
|
|
282
|
-
_a["user-disabled" /* USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
283
|
-
_a["user-mismatch" /* USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
284
|
-
_a["user-signed-out" /* USER_SIGNED_OUT */] = '',
|
|
285
|
-
_a["weak-password" /* WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
286
|
-
_a["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
287
|
-
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
282
|
+
_a["user-disabled" /* AuthErrorCode.USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
283
|
+
_a["user-mismatch" /* AuthErrorCode.USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
284
|
+
_a["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */] = '',
|
|
285
|
+
_a["weak-password" /* AuthErrorCode.WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
286
|
+
_a["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
287
|
+
_a["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
288
288
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
289
289
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
290
290
|
' already initialized instance.',
|
|
@@ -296,7 +296,7 @@ function _prodErrorMap() {
|
|
|
296
296
|
// nature of this error, developers will never be able to see the message
|
|
297
297
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
298
298
|
return _a = {},
|
|
299
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
299
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
300
300
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
301
301
|
'starting any other Firebase SDK.',
|
|
302
302
|
_a;
|
|
@@ -450,7 +450,7 @@ function _logError(msg) {
|
|
|
450
450
|
args[_i - 1] = arguments[_i];
|
|
451
451
|
}
|
|
452
452
|
if (logClient.logLevel <= logger.LogLevel.ERROR) {
|
|
453
|
-
logClient.error.apply(logClient, tslib.__spreadArray(["Auth ("
|
|
453
|
+
logClient.error.apply(logClient, tslib.__spreadArray(["Auth (".concat(app.SDK_VERSION, "): ").concat(msg)], args, false));
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
|
|
@@ -475,14 +475,14 @@ function _fail(authOrCode) {
|
|
|
475
475
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
476
476
|
rest[_i - 1] = arguments[_i];
|
|
477
477
|
}
|
|
478
|
-
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
478
|
+
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
479
479
|
}
|
|
480
480
|
function _createError(authOrCode) {
|
|
481
481
|
var rest = [];
|
|
482
482
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
483
483
|
rest[_i - 1] = arguments[_i];
|
|
484
484
|
}
|
|
485
|
-
return createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
485
|
+
return createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
486
486
|
}
|
|
487
487
|
function _errorWithCustomMessage(auth, code, message) {
|
|
488
488
|
var _a;
|
|
@@ -500,13 +500,13 @@ function createErrorInternal(authOrCode) {
|
|
|
500
500
|
}
|
|
501
501
|
if (typeof authOrCode !== 'string') {
|
|
502
502
|
var code = rest[0];
|
|
503
|
-
var fullParams = tslib.__spreadArray([], rest.slice(1));
|
|
503
|
+
var fullParams = tslib.__spreadArray([], rest.slice(1), true);
|
|
504
504
|
if (fullParams[0]) {
|
|
505
505
|
fullParams[0].appName = authOrCode.name;
|
|
506
506
|
}
|
|
507
|
-
return (_a = authOrCode._errorFactory).create.apply(_a, tslib.__spreadArray([code], fullParams));
|
|
507
|
+
return (_a = authOrCode._errorFactory).create.apply(_a, tslib.__spreadArray([code], fullParams, false));
|
|
508
508
|
}
|
|
509
|
-
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, tslib.__spreadArray([authOrCode], rest));
|
|
509
|
+
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, tslib.__spreadArray([authOrCode], rest, false));
|
|
510
510
|
}
|
|
511
511
|
function _assert(assertion, authOrCode) {
|
|
512
512
|
var rest = [];
|
|
@@ -514,7 +514,7 @@ function _assert(assertion, authOrCode) {
|
|
|
514
514
|
rest[_i - 2] = arguments[_i];
|
|
515
515
|
}
|
|
516
516
|
if (!assertion) {
|
|
517
|
-
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
517
|
+
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
/**
|
|
@@ -625,7 +625,7 @@ function initializeAuth(app$1, deps) {
|
|
|
625
625
|
return auth_1;
|
|
626
626
|
}
|
|
627
627
|
else {
|
|
628
|
-
_fail(auth_1, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
628
|
+
_fail(auth_1, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
631
|
var auth = provider.initialize({ options: deps });
|
|
@@ -753,7 +753,7 @@ var Delay = /** @class */ (function () {
|
|
|
753
753
|
Delay.prototype.get = function () {
|
|
754
754
|
if (!_isOnline()) {
|
|
755
755
|
// Pick the shorter timeout.
|
|
756
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
756
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
757
757
|
}
|
|
758
758
|
// If running in a mobile environment, return the long delay, otherwise
|
|
759
759
|
// return the short delay.
|
|
@@ -786,7 +786,7 @@ function _emulatorUrl(config, path) {
|
|
|
786
786
|
if (!path) {
|
|
787
787
|
return url;
|
|
788
788
|
}
|
|
789
|
-
return ""
|
|
789
|
+
return "".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
/**
|
|
@@ -869,64 +869,64 @@ var _a$1;
|
|
|
869
869
|
*/
|
|
870
870
|
var SERVER_ERROR_MAP = (_a$1 = {},
|
|
871
871
|
// Custom token errors.
|
|
872
|
-
_a$1["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
872
|
+
_a$1["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
873
873
|
// This can only happen if the SDK sends a bad request.
|
|
874
|
-
_a$1["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */] = "internal-error" /* INTERNAL_ERROR */,
|
|
874
|
+
_a$1["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
875
875
|
// Create Auth URI errors.
|
|
876
|
-
_a$1["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */] = "invalid-email" /* INVALID_EMAIL */,
|
|
876
|
+
_a$1["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */] = "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
877
877
|
// This can only happen if the SDK sends a bad request.
|
|
878
|
-
_a$1["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */] = "internal-error" /* INTERNAL_ERROR */,
|
|
878
|
+
_a$1["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
879
879
|
// Sign in with email and password errors (some apply to sign up too).
|
|
880
|
-
_a$1["INVALID_PASSWORD" /* INVALID_PASSWORD */] = "wrong-password" /* INVALID_PASSWORD */,
|
|
880
|
+
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
881
881
|
// This can only happen if the SDK sends a bad request.
|
|
882
|
-
_a$1["MISSING_PASSWORD" /* MISSING_PASSWORD */] = "internal-error" /* INTERNAL_ERROR */,
|
|
882
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
883
883
|
// Sign up with email and password errors.
|
|
884
|
-
_a$1["EMAIL_EXISTS" /* EMAIL_EXISTS */] = "email-already-in-use" /* EMAIL_EXISTS */,
|
|
885
|
-
_a$1["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
884
|
+
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
885
|
+
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
886
886
|
// Verify assertion for sign in with credential errors:
|
|
887
|
-
_a$1["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
888
|
-
_a$1["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
889
|
-
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
887
|
+
_a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
888
|
+
_a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
889
|
+
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
890
890
|
// This can only happen if the SDK sends a bad request.
|
|
891
|
-
_a$1["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
891
|
+
_a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
892
892
|
// Send Password reset email errors:
|
|
893
|
-
_a$1["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
894
|
-
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
895
|
-
_a$1["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */] = "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
896
|
-
_a$1["INVALID_OOB_CODE" /* INVALID_OOB_CODE */] = "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
893
|
+
_a$1["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
894
|
+
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
895
|
+
_a$1["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */] = "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
896
|
+
_a$1["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */] = "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
897
897
|
// This can only happen if the SDK sends a bad request.
|
|
898
|
-
_a$1["MISSING_OOB_CODE" /* MISSING_OOB_CODE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
898
|
+
_a$1["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
899
899
|
// Operations that require ID token in request:
|
|
900
|
-
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
901
|
-
_a$1["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */] = "invalid-user-token" /* INVALID_AUTH */,
|
|
902
|
-
_a$1["TOKEN_EXPIRED" /* TOKEN_EXPIRED */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
903
|
-
_a$1["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
900
|
+
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
901
|
+
_a$1["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */] = "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
902
|
+
_a$1["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
903
|
+
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
904
904
|
// Other errors.
|
|
905
|
-
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
905
|
+
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
906
906
|
// Phone Auth related errors.
|
|
907
|
-
_a$1["INVALID_CODE" /* INVALID_CODE */] = "invalid-verification-code" /* INVALID_CODE */,
|
|
908
|
-
_a$1["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */] = "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
909
|
-
_a$1["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
910
|
-
_a$1["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */] = "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
911
|
-
_a$1["SESSION_EXPIRED" /* SESSION_EXPIRED */] = "code-expired" /* CODE_EXPIRED */,
|
|
907
|
+
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
908
|
+
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
909
|
+
_a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
910
|
+
_a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
911
|
+
_a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
912
912
|
// Other action code errors when additional settings passed.
|
|
913
913
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
914
914
|
// This is OK as this error will be caught by client side validation.
|
|
915
|
-
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
916
|
-
_a$1["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
915
|
+
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
916
|
+
_a$1["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
917
917
|
// getProjectConfig errors when clientId is passed.
|
|
918
|
-
_a$1["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
918
|
+
_a$1["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
919
919
|
// User actions (sign-up or deletion) disabled errors.
|
|
920
|
-
_a$1["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
920
|
+
_a$1["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
921
921
|
// Multi factor related errors.
|
|
922
|
-
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
923
|
-
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
924
|
-
_a$1["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
925
|
-
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
926
|
-
_a$1["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
927
|
-
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
922
|
+
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
923
|
+
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
924
|
+
_a$1["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
925
|
+
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
926
|
+
_a$1["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
927
|
+
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
928
928
|
// Blocking functions related errors.
|
|
929
|
-
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
929
|
+
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
930
930
|
_a$1);
|
|
931
931
|
|
|
932
932
|
/**
|
|
@@ -965,7 +965,7 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
965
965
|
body = {};
|
|
966
966
|
params = {};
|
|
967
967
|
if (request) {
|
|
968
|
-
if (method === "GET" /* GET */) {
|
|
968
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
969
969
|
params = request;
|
|
970
970
|
}
|
|
971
971
|
else {
|
|
@@ -978,12 +978,11 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
978
978
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
979
979
|
case 1:
|
|
980
980
|
headers = _a.sent();
|
|
981
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
981
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
982
982
|
if (auth.languageCode) {
|
|
983
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
983
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
984
984
|
}
|
|
985
|
-
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), tslib.__assign({ method: method,
|
|
986
|
-
headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
985
|
+
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), tslib.__assign({ method: method, headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
987
986
|
}
|
|
988
987
|
});
|
|
989
988
|
}); })];
|
|
@@ -1015,7 +1014,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1015
1014
|
case 3:
|
|
1016
1015
|
json = _b.sent();
|
|
1017
1016
|
if ('needConfirmation' in json) {
|
|
1018
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
1017
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
1019
1018
|
}
|
|
1020
1019
|
if (response.ok && !('errorMessage' in json)) {
|
|
1021
1020
|
return [2 /*return*/, json];
|
|
@@ -1023,14 +1022,14 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1023
1022
|
else {
|
|
1024
1023
|
errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
1025
1024
|
_a = errorMessage.split(' : '), serverErrorCode = _a[0], serverErrorMessage = _a[1];
|
|
1026
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1027
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1025
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1026
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1028
1027
|
}
|
|
1029
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
1030
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
1028
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
1029
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
1031
1030
|
}
|
|
1032
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
1033
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
1031
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
1032
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
1034
1033
|
}
|
|
1035
1034
|
authError = errorMap[serverErrorCode] ||
|
|
1036
1035
|
serverErrorCode
|
|
@@ -1049,7 +1048,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1049
1048
|
if (e_1 instanceof util.FirebaseError) {
|
|
1050
1049
|
throw e_1;
|
|
1051
1050
|
}
|
|
1052
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
1051
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
1053
1052
|
return [3 /*break*/, 5];
|
|
1054
1053
|
case 5: return [2 /*return*/];
|
|
1055
1054
|
}
|
|
@@ -1066,7 +1065,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1066
1065
|
case 1:
|
|
1067
1066
|
serverResponse = (_a.sent());
|
|
1068
1067
|
if ('mfaPendingCredential' in serverResponse) {
|
|
1069
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
1068
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
1070
1069
|
_serverResponse: serverResponse
|
|
1071
1070
|
});
|
|
1072
1071
|
}
|
|
@@ -1076,9 +1075,9 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1076
1075
|
});
|
|
1077
1076
|
}
|
|
1078
1077
|
function _getFinalTarget(auth, host, path, query) {
|
|
1079
|
-
var base = ""
|
|
1078
|
+
var base = "".concat(host).concat(path, "?").concat(query);
|
|
1080
1079
|
if (!auth.config.emulator) {
|
|
1081
|
-
return auth.config.apiScheme
|
|
1080
|
+
return "".concat(auth.config.apiScheme, "://").concat(base);
|
|
1082
1081
|
}
|
|
1083
1082
|
return _emulatorUrl(auth.config, base);
|
|
1084
1083
|
}
|
|
@@ -1092,7 +1091,7 @@ var NetworkTimeout = /** @class */ (function () {
|
|
|
1092
1091
|
this.timer = null;
|
|
1093
1092
|
this.promise = new Promise(function (_, reject) {
|
|
1094
1093
|
_this.timer = setTimeout(function () {
|
|
1095
|
-
return reject(_createError(_this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1094
|
+
return reject(_createError(_this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1096
1095
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1097
1096
|
});
|
|
1098
1097
|
}
|
|
@@ -1136,21 +1135,21 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1136
1135
|
function deleteAccount(auth, request) {
|
|
1137
1136
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1138
1137
|
return tslib.__generator(this, function (_a) {
|
|
1139
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request)];
|
|
1138
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request)];
|
|
1140
1139
|
});
|
|
1141
1140
|
});
|
|
1142
1141
|
}
|
|
1143
1142
|
function deleteLinkedAccounts(auth, request) {
|
|
1144
1143
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1145
1144
|
return tslib.__generator(this, function (_a) {
|
|
1146
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
1145
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
1147
1146
|
});
|
|
1148
1147
|
});
|
|
1149
1148
|
}
|
|
1150
1149
|
function getAccountInfo(auth, request) {
|
|
1151
1150
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1152
1151
|
return tslib.__generator(this, function (_a) {
|
|
1153
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request)];
|
|
1152
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request)];
|
|
1154
1153
|
});
|
|
1155
1154
|
});
|
|
1156
1155
|
}
|
|
@@ -1246,7 +1245,7 @@ function getIdTokenResult(user, forceRefresh) {
|
|
|
1246
1245
|
case 1:
|
|
1247
1246
|
token = _a.sent();
|
|
1248
1247
|
claims = _parseToken(token);
|
|
1249
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1248
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1250
1249
|
firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1251
1250
|
signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1252
1251
|
return [2 /*return*/, {
|
|
@@ -1266,8 +1265,7 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1266
1265
|
return Number(seconds) * 1000;
|
|
1267
1266
|
}
|
|
1268
1267
|
function _parseToken(token) {
|
|
1269
|
-
var _a;
|
|
1270
|
-
var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
|
|
1268
|
+
var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
|
|
1271
1269
|
if (algorithm === undefined ||
|
|
1272
1270
|
payload === undefined ||
|
|
1273
1271
|
signature === undefined) {
|
|
@@ -1283,7 +1281,7 @@ function _parseToken(token) {
|
|
|
1283
1281
|
return JSON.parse(decoded);
|
|
1284
1282
|
}
|
|
1285
1283
|
catch (e) {
|
|
1286
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1284
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1287
1285
|
return null;
|
|
1288
1286
|
}
|
|
1289
1287
|
}
|
|
@@ -1292,9 +1290,9 @@ function _parseToken(token) {
|
|
|
1292
1290
|
*/
|
|
1293
1291
|
function _tokenExpiresIn(token) {
|
|
1294
1292
|
var parsedToken = _parseToken(token);
|
|
1295
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1296
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1297
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1293
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1294
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1295
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1298
1296
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1299
1297
|
}
|
|
1300
1298
|
|
|
@@ -1345,8 +1343,8 @@ function _logoutIfInvalidated(user, promise, bypassAuthState) {
|
|
|
1345
1343
|
}
|
|
1346
1344
|
function isUserInvalidated(_a) {
|
|
1347
1345
|
var code = _a.code;
|
|
1348
|
-
return (code === "auth/"
|
|
1349
|
-
code === "auth/"
|
|
1346
|
+
return (code === "auth/".concat("user-disabled" /* AuthErrorCode.USER_DISABLED */) ||
|
|
1347
|
+
code === "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */));
|
|
1350
1348
|
}
|
|
1351
1349
|
|
|
1352
1350
|
/**
|
|
@@ -1374,7 +1372,7 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1374
1372
|
// we can't cast properly in both environments.
|
|
1375
1373
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1376
1374
|
this.timerId = null;
|
|
1377
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1375
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1378
1376
|
}
|
|
1379
1377
|
ProactiveRefresh.prototype._start = function () {
|
|
1380
1378
|
if (this.isRunning) {
|
|
@@ -1396,14 +1394,14 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1396
1394
|
var _a;
|
|
1397
1395
|
if (wasError) {
|
|
1398
1396
|
var interval = this.errorBackoff;
|
|
1399
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1397
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1400
1398
|
return interval;
|
|
1401
1399
|
}
|
|
1402
1400
|
else {
|
|
1403
1401
|
// Reset the error backoff
|
|
1404
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1402
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1405
1403
|
var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1406
|
-
var interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1404
|
+
var interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1407
1405
|
return Math.max(0, interval);
|
|
1408
1406
|
}
|
|
1409
1407
|
};
|
|
@@ -1427,22 +1425,21 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1427
1425
|
}); }, interval);
|
|
1428
1426
|
};
|
|
1429
1427
|
ProactiveRefresh.prototype.iteration = function () {
|
|
1430
|
-
var _a;
|
|
1431
1428
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1432
1429
|
var e_1;
|
|
1433
|
-
return tslib.__generator(this, function (
|
|
1434
|
-
switch (
|
|
1430
|
+
return tslib.__generator(this, function (_a) {
|
|
1431
|
+
switch (_a.label) {
|
|
1435
1432
|
case 0:
|
|
1436
|
-
|
|
1433
|
+
_a.trys.push([0, 2, , 3]);
|
|
1437
1434
|
return [4 /*yield*/, this.user.getIdToken(true)];
|
|
1438
1435
|
case 1:
|
|
1439
|
-
|
|
1436
|
+
_a.sent();
|
|
1440
1437
|
return [3 /*break*/, 3];
|
|
1441
1438
|
case 2:
|
|
1442
|
-
e_1 =
|
|
1439
|
+
e_1 = _a.sent();
|
|
1443
1440
|
// Only retry on network errors
|
|
1444
|
-
if ((
|
|
1445
|
-
"auth/"
|
|
1441
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) ===
|
|
1442
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
1446
1443
|
this.schedule(/* wasError */ true);
|
|
1447
1444
|
}
|
|
1448
1445
|
return [2 /*return*/];
|
|
@@ -1526,7 +1523,7 @@ function _reloadWithoutSaving(user) {
|
|
|
1526
1523
|
return [4 /*yield*/, _logoutIfInvalidated(user, getAccountInfo(auth, { idToken: idToken }))];
|
|
1527
1524
|
case 2:
|
|
1528
1525
|
response = _b.sent();
|
|
1529
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1526
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1530
1527
|
coreAccount = response.users[0];
|
|
1531
1528
|
user._notifyReloadListener(coreAccount);
|
|
1532
1529
|
newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1588,7 +1585,7 @@ function reload(user) {
|
|
|
1588
1585
|
}
|
|
1589
1586
|
function mergeProviderData(original, newData) {
|
|
1590
1587
|
var deduped = original.filter(function (o) { return !newData.some(function (n) { return n.providerId === o.providerId; }); });
|
|
1591
|
-
return tslib.__spreadArray(tslib.__spreadArray([], deduped), newData);
|
|
1588
|
+
return tslib.__spreadArray(tslib.__spreadArray([], deduped, true), newData, true);
|
|
1592
1589
|
}
|
|
1593
1590
|
function extractProviderData(providers) {
|
|
1594
1591
|
return providers.map(function (_a) {
|
|
@@ -1636,13 +1633,13 @@ function requestStsToken(auth, refreshToken) {
|
|
|
1636
1633
|
'refresh_token': refreshToken
|
|
1637
1634
|
}).slice(1);
|
|
1638
1635
|
_a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
|
|
1639
|
-
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key="
|
|
1636
|
+
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, "key=".concat(apiKey));
|
|
1640
1637
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1641
1638
|
case 1:
|
|
1642
1639
|
headers = _b.sent();
|
|
1643
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1640
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1644
1641
|
return [2 /*return*/, FetchProvider.fetch()(url, {
|
|
1645
|
-
method: "POST" /* POST */,
|
|
1642
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1646
1643
|
headers: headers,
|
|
1647
1644
|
body: body
|
|
1648
1645
|
})];
|
|
@@ -1693,15 +1690,15 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1693
1690
|
Object.defineProperty(StsTokenManager.prototype, "isExpired", {
|
|
1694
1691
|
get: function () {
|
|
1695
1692
|
return (!this.expirationTime ||
|
|
1696
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1693
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1697
1694
|
},
|
|
1698
1695
|
enumerable: false,
|
|
1699
1696
|
configurable: true
|
|
1700
1697
|
});
|
|
1701
1698
|
StsTokenManager.prototype.updateFromServerResponse = function (response) {
|
|
1702
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1703
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1704
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1699
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1700
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1701
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1705
1702
|
var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1706
1703
|
? Number(response.expiresIn)
|
|
1707
1704
|
: _tokenExpiresIn(response.idToken);
|
|
@@ -1713,7 +1710,7 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1713
1710
|
return tslib.__generator(this, function (_a) {
|
|
1714
1711
|
switch (_a.label) {
|
|
1715
1712
|
case 0:
|
|
1716
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1713
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1717
1714
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1718
1715
|
return [2 /*return*/, this.accessToken];
|
|
1719
1716
|
}
|
|
@@ -1753,19 +1750,19 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1753
1750
|
var refreshToken = object.refreshToken, accessToken = object.accessToken, expirationTime = object.expirationTime;
|
|
1754
1751
|
var manager = new StsTokenManager();
|
|
1755
1752
|
if (refreshToken) {
|
|
1756
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1753
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1757
1754
|
appName: appName
|
|
1758
1755
|
});
|
|
1759
1756
|
manager.refreshToken = refreshToken;
|
|
1760
1757
|
}
|
|
1761
1758
|
if (accessToken) {
|
|
1762
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1759
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1763
1760
|
appName: appName
|
|
1764
1761
|
});
|
|
1765
1762
|
manager.accessToken = accessToken;
|
|
1766
1763
|
}
|
|
1767
1764
|
if (expirationTime) {
|
|
1768
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1765
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1769
1766
|
appName: appName
|
|
1770
1767
|
});
|
|
1771
1768
|
manager.expirationTime = expirationTime;
|
|
@@ -1810,13 +1807,13 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1810
1807
|
* limitations under the License.
|
|
1811
1808
|
*/
|
|
1812
1809
|
function assertStringOrUndefined(assertion, appName) {
|
|
1813
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName: appName });
|
|
1810
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName: appName });
|
|
1814
1811
|
}
|
|
1815
1812
|
var UserImpl = /** @class */ (function () {
|
|
1816
1813
|
function UserImpl(_a) {
|
|
1817
1814
|
var uid = _a.uid, auth = _a.auth, stsTokenManager = _a.stsTokenManager, opt = tslib.__rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1818
1815
|
// For the user object, provider is always Firebase.
|
|
1819
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1816
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1820
1817
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1821
1818
|
this.reloadUserInfo = null;
|
|
1822
1819
|
this.reloadListener = null;
|
|
@@ -1831,7 +1828,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1831
1828
|
this.photoURL = opt.photoURL || null;
|
|
1832
1829
|
this.isAnonymous = opt.isAnonymous || false;
|
|
1833
1830
|
this.tenantId = opt.tenantId || null;
|
|
1834
|
-
this.providerData = opt.providerData ? tslib.__spreadArray([], opt.providerData) : [];
|
|
1831
|
+
this.providerData = opt.providerData ? tslib.__spreadArray([], opt.providerData, true) : [];
|
|
1835
1832
|
this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);
|
|
1836
1833
|
}
|
|
1837
1834
|
UserImpl.prototype.getIdToken = function (forceRefresh) {
|
|
@@ -1842,7 +1839,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1842
1839
|
case 0: return [4 /*yield*/, _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh))];
|
|
1843
1840
|
case 1:
|
|
1844
1841
|
accessToken = _a.sent();
|
|
1845
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1842
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1846
1843
|
if (!(this.accessToken !== accessToken)) return [3 /*break*/, 3];
|
|
1847
1844
|
this.accessToken = accessToken;
|
|
1848
1845
|
return [4 /*yield*/, this.auth._persistUserIfCurrent(this)];
|
|
@@ -1865,7 +1862,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1865
1862
|
if (this === user) {
|
|
1866
1863
|
return;
|
|
1867
1864
|
}
|
|
1868
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1865
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1869
1866
|
this.displayName = user.displayName;
|
|
1870
1867
|
this.photoURL = user.photoURL;
|
|
1871
1868
|
this.email = user.email;
|
|
@@ -1882,7 +1879,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1882
1879
|
};
|
|
1883
1880
|
UserImpl.prototype._onReload = function (callback) {
|
|
1884
1881
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1885
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1882
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1886
1883
|
this.reloadListener = callback;
|
|
1887
1884
|
if (this.reloadUserInfo) {
|
|
1888
1885
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -1978,13 +1975,13 @@ var UserImpl = /** @class */ (function () {
|
|
|
1978
1975
|
var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1979
1976
|
var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
1980
1977
|
var uid = object.uid, emailVerified = object.emailVerified, isAnonymous = object.isAnonymous, providerData = object.providerData, plainObjectTokenManager = object.stsTokenManager;
|
|
1981
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1978
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1982
1979
|
var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
1983
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1980
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1984
1981
|
assertStringOrUndefined(displayName, auth.name);
|
|
1985
1982
|
assertStringOrUndefined(email, auth.name);
|
|
1986
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1987
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1983
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1984
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1988
1985
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
1989
1986
|
assertStringOrUndefined(photoURL, auth.name);
|
|
1990
1987
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -2064,7 +2061,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2064
2061
|
*/
|
|
2065
2062
|
var InMemoryPersistence = /** @class */ (function () {
|
|
2066
2063
|
function InMemoryPersistence() {
|
|
2067
|
-
this.type = "NONE" /* NONE */;
|
|
2064
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
2068
2065
|
this.storage = {};
|
|
2069
2066
|
}
|
|
2070
2067
|
InMemoryPersistence.prototype._isAvailable = function () {
|
|
@@ -2134,7 +2131,7 @@ var inMemoryPersistence = InMemoryPersistence;
|
|
|
2134
2131
|
* limitations under the License.
|
|
2135
2132
|
*/
|
|
2136
2133
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
2137
|
-
return "firebase" /* PERSISTENCE
|
|
2134
|
+
return "".concat("firebase" /* Namespace.PERSISTENCE */, ":").concat(key, ":").concat(apiKey, ":").concat(appName);
|
|
2138
2135
|
}
|
|
2139
2136
|
var PersistenceUserManager = /** @class */ (function () {
|
|
2140
2137
|
function PersistenceUserManager(persistence, auth, userKey) {
|
|
@@ -2143,7 +2140,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2143
2140
|
this.userKey = userKey;
|
|
2144
2141
|
var _a = this.auth, config = _a.config, name = _a.name;
|
|
2145
2142
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
2146
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
2143
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
2147
2144
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
2148
2145
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
2149
2146
|
}
|
|
@@ -2197,7 +2194,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2197
2194
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
2198
2195
|
};
|
|
2199
2196
|
PersistenceUserManager.create = function (auth, persistenceHierarchy, userKey) {
|
|
2200
|
-
if (userKey === void 0) { userKey = "authUser" /* AUTH_USER */; }
|
|
2197
|
+
if (userKey === void 0) { userKey = "authUser" /* KeyName.AUTH_USER */; }
|
|
2201
2198
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2202
2199
|
var availablePersistences, selectedPersistence, key, userToMigrate, _i, persistenceHierarchy_1, persistence, blob, user, migrationHierarchy;
|
|
2203
2200
|
var _this = this;
|
|
@@ -2324,42 +2321,42 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2324
2321
|
function _getBrowserName(userAgent) {
|
|
2325
2322
|
var ua = userAgent.toLowerCase();
|
|
2326
2323
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
2327
|
-
return "Opera" /* OPERA */;
|
|
2324
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
2328
2325
|
}
|
|
2329
2326
|
else if (_isIEMobile(ua)) {
|
|
2330
2327
|
// Windows phone IEMobile browser.
|
|
2331
|
-
return "IEMobile" /* IEMOBILE */;
|
|
2328
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
2332
2329
|
}
|
|
2333
2330
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
2334
|
-
return "IE" /* IE */;
|
|
2331
|
+
return "IE" /* BrowserName.IE */;
|
|
2335
2332
|
}
|
|
2336
2333
|
else if (ua.includes('edge/')) {
|
|
2337
|
-
return "Edge" /* EDGE */;
|
|
2334
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
2338
2335
|
}
|
|
2339
2336
|
else if (_isFirefox(ua)) {
|
|
2340
|
-
return "Firefox" /* FIREFOX */;
|
|
2337
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
2341
2338
|
}
|
|
2342
2339
|
else if (ua.includes('silk/')) {
|
|
2343
|
-
return "Silk" /* SILK */;
|
|
2340
|
+
return "Silk" /* BrowserName.SILK */;
|
|
2344
2341
|
}
|
|
2345
2342
|
else if (_isBlackBerry(ua)) {
|
|
2346
2343
|
// Blackberry browser.
|
|
2347
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
2344
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
2348
2345
|
}
|
|
2349
2346
|
else if (_isWebOS(ua)) {
|
|
2350
2347
|
// WebOS default browser.
|
|
2351
|
-
return "Webos" /* WEBOS */;
|
|
2348
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
2352
2349
|
}
|
|
2353
2350
|
else if (_isSafari(ua)) {
|
|
2354
|
-
return "Safari" /* SAFARI */;
|
|
2351
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
2355
2352
|
}
|
|
2356
2353
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
2357
2354
|
!ua.includes('edge/')) {
|
|
2358
|
-
return "Chrome" /* CHROME */;
|
|
2355
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
2359
2356
|
}
|
|
2360
2357
|
else if (_isAndroid(ua)) {
|
|
2361
2358
|
// Android stock browser.
|
|
2362
|
-
return "Android" /* ANDROID */;
|
|
2359
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
2363
2360
|
}
|
|
2364
2361
|
else {
|
|
2365
2362
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -2369,7 +2366,7 @@ function _getBrowserName(userAgent) {
|
|
|
2369
2366
|
return matches[1];
|
|
2370
2367
|
}
|
|
2371
2368
|
}
|
|
2372
|
-
return "Other" /* OTHER */;
|
|
2369
|
+
return "Other" /* BrowserName.OTHER */;
|
|
2373
2370
|
}
|
|
2374
2371
|
function _isFirefox(ua) {
|
|
2375
2372
|
if (ua === void 0) { ua = util.getUA(); }
|
|
@@ -2460,15 +2457,15 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2460
2457
|
if (frameworks === void 0) { frameworks = []; }
|
|
2461
2458
|
var reportedPlatform;
|
|
2462
2459
|
switch (clientPlatform) {
|
|
2463
|
-
case "Browser" /* BROWSER */:
|
|
2460
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
2464
2461
|
// In a browser environment, report the browser name.
|
|
2465
2462
|
reportedPlatform = _getBrowserName(util.getUA());
|
|
2466
2463
|
break;
|
|
2467
|
-
case "Worker" /* WORKER */:
|
|
2464
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
2468
2465
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
2469
2466
|
// worker from a browser.
|
|
2470
2467
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
2471
|
-
reportedPlatform = _getBrowserName(util.getUA())
|
|
2468
|
+
reportedPlatform = "".concat(_getBrowserName(util.getUA()), "-").concat(clientPlatform);
|
|
2472
2469
|
break;
|
|
2473
2470
|
default:
|
|
2474
2471
|
reportedPlatform = clientPlatform;
|
|
@@ -2476,7 +2473,7 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2476
2473
|
var reportedFrameworks = frameworks.length
|
|
2477
2474
|
? frameworks.join(',')
|
|
2478
2475
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
2479
|
-
return reportedPlatform
|
|
2476
|
+
return "".concat(reportedPlatform, "/").concat("JsCore" /* ClientImplementation.CORE */, "/").concat(app.SDK_VERSION, "/").concat(reportedFrameworks);
|
|
2480
2477
|
}
|
|
2481
2478
|
|
|
2482
2479
|
/**
|
|
@@ -2529,43 +2526,42 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2529
2526
|
};
|
|
2530
2527
|
};
|
|
2531
2528
|
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2532
|
-
var _a;
|
|
2533
2529
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2534
|
-
var onAbortStack, _i,
|
|
2535
|
-
return tslib.__generator(this, function (
|
|
2536
|
-
switch (
|
|
2530
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2531
|
+
return tslib.__generator(this, function (_c) {
|
|
2532
|
+
switch (_c.label) {
|
|
2537
2533
|
case 0:
|
|
2538
2534
|
if (this.auth.currentUser === nextUser) {
|
|
2539
2535
|
return [2 /*return*/];
|
|
2540
2536
|
}
|
|
2541
2537
|
onAbortStack = [];
|
|
2542
|
-
|
|
2538
|
+
_c.label = 1;
|
|
2543
2539
|
case 1:
|
|
2544
|
-
|
|
2545
|
-
_i = 0,
|
|
2546
|
-
|
|
2540
|
+
_c.trys.push([1, 6, , 7]);
|
|
2541
|
+
_i = 0, _a = this.queue;
|
|
2542
|
+
_c.label = 2;
|
|
2547
2543
|
case 2:
|
|
2548
|
-
if (!(_i <
|
|
2549
|
-
beforeStateCallback =
|
|
2544
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2545
|
+
beforeStateCallback = _a[_i];
|
|
2550
2546
|
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2551
2547
|
case 3:
|
|
2552
|
-
|
|
2548
|
+
_c.sent();
|
|
2553
2549
|
// Only push the onAbort if the callback succeeds
|
|
2554
2550
|
if (beforeStateCallback.onAbort) {
|
|
2555
2551
|
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2556
2552
|
}
|
|
2557
|
-
|
|
2553
|
+
_c.label = 4;
|
|
2558
2554
|
case 4:
|
|
2559
2555
|
_i++;
|
|
2560
2556
|
return [3 /*break*/, 2];
|
|
2561
2557
|
case 5: return [3 /*break*/, 7];
|
|
2562
2558
|
case 6:
|
|
2563
|
-
e_1 =
|
|
2559
|
+
e_1 = _c.sent();
|
|
2564
2560
|
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2565
2561
|
// continue
|
|
2566
2562
|
onAbortStack.reverse();
|
|
2567
|
-
for (
|
|
2568
|
-
onAbort = onAbortStack_1[
|
|
2563
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2564
|
+
onAbort = onAbortStack_1[_b];
|
|
2569
2565
|
try {
|
|
2570
2566
|
onAbort();
|
|
2571
2567
|
}
|
|
@@ -2573,8 +2569,8 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2573
2569
|
/* swallow error */
|
|
2574
2570
|
}
|
|
2575
2571
|
}
|
|
2576
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2577
|
-
originalMessage:
|
|
2572
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2573
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2578
2574
|
});
|
|
2579
2575
|
case 7: return [2 /*return*/];
|
|
2580
2576
|
}
|
|
@@ -2784,7 +2780,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2784
2780
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
2785
2781
|
}
|
|
2786
2782
|
case 9:
|
|
2787
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2783
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2788
2784
|
return [4 /*yield*/, this.getOrInitRedirectPersistenceManager()];
|
|
2789
2785
|
case 10:
|
|
2790
2786
|
_b.sent();
|
|
@@ -2832,21 +2828,20 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2832
2828
|
});
|
|
2833
2829
|
};
|
|
2834
2830
|
AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
|
|
2835
|
-
var _a;
|
|
2836
2831
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2837
2832
|
var e_4;
|
|
2838
|
-
return tslib.__generator(this, function (
|
|
2839
|
-
switch (
|
|
2833
|
+
return tslib.__generator(this, function (_a) {
|
|
2834
|
+
switch (_a.label) {
|
|
2840
2835
|
case 0:
|
|
2841
|
-
|
|
2836
|
+
_a.trys.push([0, 2, , 3]);
|
|
2842
2837
|
return [4 /*yield*/, _reloadWithoutSaving(user)];
|
|
2843
2838
|
case 1:
|
|
2844
|
-
|
|
2839
|
+
_a.sent();
|
|
2845
2840
|
return [3 /*break*/, 3];
|
|
2846
2841
|
case 2:
|
|
2847
|
-
e_4 =
|
|
2848
|
-
if ((
|
|
2849
|
-
"auth/"
|
|
2842
|
+
e_4 = _a.sent();
|
|
2843
|
+
if ((e_4 === null || e_4 === void 0 ? void 0 : e_4.code) !==
|
|
2844
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
2850
2845
|
// Something's wrong with the user's token. Log them out and remove
|
|
2851
2846
|
// them from storage
|
|
2852
2847
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
@@ -2876,7 +2871,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2876
2871
|
? util.getModularInstance(userExtern)
|
|
2877
2872
|
: null;
|
|
2878
2873
|
if (user) {
|
|
2879
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2874
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2880
2875
|
}
|
|
2881
2876
|
return [2 /*return*/, this._updateCurrentUser(user && user._clone(this))];
|
|
2882
2877
|
});
|
|
@@ -2893,7 +2888,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2893
2888
|
return [2 /*return*/];
|
|
2894
2889
|
}
|
|
2895
2890
|
if (user) {
|
|
2896
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2891
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2897
2892
|
}
|
|
2898
2893
|
if (!!skipBeforeStateCallbacks) return [3 /*break*/, 2];
|
|
2899
2894
|
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(user)];
|
|
@@ -2999,9 +2994,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2999
2994
|
if (!!this.redirectPersistenceManager) return [3 /*break*/, 3];
|
|
3000
2995
|
resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
3001
2996
|
this._popupRedirectResolver;
|
|
3002
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2997
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3003
2998
|
_a = this;
|
|
3004
|
-
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */)];
|
|
2999
|
+
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */)];
|
|
3005
3000
|
case 1:
|
|
3006
3001
|
_a.redirectPersistenceManager = _c.sent();
|
|
3007
3002
|
_b = this;
|
|
@@ -3061,7 +3056,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3061
3056
|
}
|
|
3062
3057
|
};
|
|
3063
3058
|
AuthImpl.prototype._key = function () {
|
|
3064
|
-
return this.config.authDomain
|
|
3059
|
+
return "".concat(this.config.authDomain, ":").concat(this.config.apiKey, ":").concat(this.name);
|
|
3065
3060
|
};
|
|
3066
3061
|
AuthImpl.prototype._startProactiveRefresh = function () {
|
|
3067
3062
|
this.isProactiveRefreshEnabled = true;
|
|
@@ -3106,7 +3101,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3106
3101
|
var promise = this._isInitialized
|
|
3107
3102
|
? Promise.resolve()
|
|
3108
3103
|
: this._initializationPromise;
|
|
3109
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3104
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3110
3105
|
// The callback needs to be called asynchronously per the spec.
|
|
3111
3106
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3112
3107
|
promise.then(function () { return cb(_this.currentUser); });
|
|
@@ -3156,7 +3151,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3156
3151
|
};
|
|
3157
3152
|
Object.defineProperty(AuthImpl.prototype, "assertedPersistence", {
|
|
3158
3153
|
get: function () {
|
|
3159
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3154
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3160
3155
|
return this.persistenceManager;
|
|
3161
3156
|
},
|
|
3162
3157
|
enumerable: false,
|
|
@@ -3184,10 +3179,10 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3184
3179
|
switch (_c.label) {
|
|
3185
3180
|
case 0:
|
|
3186
3181
|
headers = (_b = {},
|
|
3187
|
-
_b["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
|
|
3182
|
+
_b["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */] = this.clientVersion,
|
|
3188
3183
|
_b);
|
|
3189
3184
|
if (this.app.options.appId) {
|
|
3190
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3185
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3191
3186
|
}
|
|
3192
3187
|
return [4 /*yield*/, ((_a = this.heartbeatServiceProvider
|
|
3193
3188
|
.getImmediate({
|
|
@@ -3196,7 +3191,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3196
3191
|
case 1:
|
|
3197
3192
|
heartbeatsHeader = _c.sent();
|
|
3198
3193
|
if (heartbeatsHeader) {
|
|
3199
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3194
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3200
3195
|
}
|
|
3201
3196
|
return [2 /*return*/, headers];
|
|
3202
3197
|
}
|
|
@@ -3224,7 +3219,7 @@ var Subscription = /** @class */ (function () {
|
|
|
3224
3219
|
}
|
|
3225
3220
|
Object.defineProperty(Subscription.prototype, "next", {
|
|
3226
3221
|
get: function () {
|
|
3227
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3222
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3228
3223
|
return this.observer.next.bind(this.observer);
|
|
3229
3224
|
},
|
|
3230
3225
|
enumerable: false,
|
|
@@ -3257,14 +3252,14 @@ var Subscription = /** @class */ (function () {
|
|
|
3257
3252
|
*/
|
|
3258
3253
|
function connectAuthEmulator(auth, url, options) {
|
|
3259
3254
|
var authInternal = _castAuth(auth);
|
|
3260
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
3261
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
3255
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
3256
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
3262
3257
|
var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
3263
3258
|
var protocol = extractProtocol(url);
|
|
3264
3259
|
var _a = extractHostAndPort(url), host = _a.host, port = _a.port;
|
|
3265
|
-
var portStr = port === null ? '' : ":"
|
|
3260
|
+
var portStr = port === null ? '' : ":".concat(port);
|
|
3266
3261
|
// Always replace path with "/" (even if input url had no path at all, or had a different one).
|
|
3267
|
-
authInternal.config.emulator = { url: protocol
|
|
3262
|
+
authInternal.config.emulator = { url: "".concat(protocol, "//").concat(host).concat(portStr, "/") };
|
|
3268
3263
|
authInternal.settings.appVerificationDisabledForTesting = true;
|
|
3269
3264
|
authInternal.emulatorConfig = Object.freeze({
|
|
3270
3265
|
host: host,
|
|
@@ -3429,21 +3424,21 @@ var AuthCredential = /** @class */ (function () {
|
|
|
3429
3424
|
function resetPassword(auth, request) {
|
|
3430
3425
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3431
3426
|
return tslib.__generator(this, function (_a) {
|
|
3432
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3427
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3433
3428
|
});
|
|
3434
3429
|
});
|
|
3435
3430
|
}
|
|
3436
3431
|
function updateEmailPassword(auth, request) {
|
|
3437
3432
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3438
3433
|
return tslib.__generator(this, function (_a) {
|
|
3439
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
3434
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
3440
3435
|
});
|
|
3441
3436
|
});
|
|
3442
3437
|
}
|
|
3443
3438
|
function applyActionCode$1(auth, request) {
|
|
3444
3439
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3445
3440
|
return tslib.__generator(this, function (_a) {
|
|
3446
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3441
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3447
3442
|
});
|
|
3448
3443
|
});
|
|
3449
3444
|
}
|
|
@@ -3467,14 +3462,14 @@ function applyActionCode$1(auth, request) {
|
|
|
3467
3462
|
function signInWithPassword(auth, request) {
|
|
3468
3463
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3469
3464
|
return tslib.__generator(this, function (_a) {
|
|
3470
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3465
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3471
3466
|
});
|
|
3472
3467
|
});
|
|
3473
3468
|
}
|
|
3474
3469
|
function sendOobCode(auth, request) {
|
|
3475
3470
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3476
3471
|
return tslib.__generator(this, function (_a) {
|
|
3477
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3472
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3478
3473
|
});
|
|
3479
3474
|
});
|
|
3480
3475
|
}
|
|
@@ -3526,14 +3521,14 @@ function verifyAndChangeEmail(auth, request) {
|
|
|
3526
3521
|
function signInWithEmailLink$1(auth, request) {
|
|
3527
3522
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3528
3523
|
return tslib.__generator(this, function (_a) {
|
|
3529
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3524
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3530
3525
|
});
|
|
3531
3526
|
});
|
|
3532
3527
|
}
|
|
3533
3528
|
function signInWithEmailLinkForLinking(auth, request) {
|
|
3534
3529
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3535
3530
|
return tslib.__generator(this, function (_a) {
|
|
3536
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3531
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3537
3532
|
});
|
|
3538
3533
|
});
|
|
3539
3534
|
}
|
|
@@ -3575,7 +3570,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3575
3570
|
/** @internal */
|
|
3576
3571
|
_tenantId) {
|
|
3577
3572
|
if (_tenantId === void 0) { _tenantId = null; }
|
|
3578
|
-
var _this = _super.call(this, "password" /* PASSWORD */, signInMethod) || this;
|
|
3573
|
+
var _this = _super.call(this, "password" /* ProviderId.PASSWORD */, signInMethod) || this;
|
|
3579
3574
|
_this._email = _email;
|
|
3580
3575
|
_this._password = _password;
|
|
3581
3576
|
_this._tenantId = _tenantId;
|
|
@@ -3583,12 +3578,12 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3583
3578
|
}
|
|
3584
3579
|
/** @internal */
|
|
3585
3580
|
EmailAuthCredential._fromEmailAndPassword = function (email, password) {
|
|
3586
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
3581
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
3587
3582
|
};
|
|
3588
3583
|
/** @internal */
|
|
3589
3584
|
EmailAuthCredential._fromEmailAndCode = function (email, oobCode, tenantId) {
|
|
3590
3585
|
if (tenantId === void 0) { tenantId = null; }
|
|
3591
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
3586
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
3592
3587
|
};
|
|
3593
3588
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
3594
3589
|
EmailAuthCredential.prototype.toJSON = function () {
|
|
@@ -3610,10 +3605,10 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3610
3605
|
EmailAuthCredential.fromJSON = function (json) {
|
|
3611
3606
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
3612
3607
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
3613
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
3608
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
3614
3609
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
3615
3610
|
}
|
|
3616
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
3611
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
3617
3612
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
3618
3613
|
}
|
|
3619
3614
|
}
|
|
@@ -3624,19 +3619,19 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3624
3619
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3625
3620
|
return tslib.__generator(this, function (_a) {
|
|
3626
3621
|
switch (this.signInMethod) {
|
|
3627
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3622
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3628
3623
|
return [2 /*return*/, signInWithPassword(auth, {
|
|
3629
3624
|
returnSecureToken: true,
|
|
3630
3625
|
email: this._email,
|
|
3631
3626
|
password: this._password
|
|
3632
3627
|
})];
|
|
3633
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3628
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3634
3629
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
3635
3630
|
email: this._email,
|
|
3636
3631
|
oobCode: this._password
|
|
3637
3632
|
})];
|
|
3638
3633
|
default:
|
|
3639
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3634
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3640
3635
|
}
|
|
3641
3636
|
return [2 /*return*/];
|
|
3642
3637
|
});
|
|
@@ -3647,21 +3642,21 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3647
3642
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3648
3643
|
return tslib.__generator(this, function (_a) {
|
|
3649
3644
|
switch (this.signInMethod) {
|
|
3650
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3645
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3651
3646
|
return [2 /*return*/, updateEmailPassword(auth, {
|
|
3652
3647
|
idToken: idToken,
|
|
3653
3648
|
returnSecureToken: true,
|
|
3654
3649
|
email: this._email,
|
|
3655
3650
|
password: this._password
|
|
3656
3651
|
})];
|
|
3657
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3652
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3658
3653
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
3659
3654
|
idToken: idToken,
|
|
3660
3655
|
email: this._email,
|
|
3661
3656
|
oobCode: this._password
|
|
3662
3657
|
})];
|
|
3663
3658
|
default:
|
|
3664
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3659
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3665
3660
|
}
|
|
3666
3661
|
return [2 /*return*/];
|
|
3667
3662
|
});
|
|
@@ -3693,7 +3688,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3693
3688
|
function signInWithIdp(auth, request) {
|
|
3694
3689
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3695
3690
|
return tslib.__generator(this, function (_a) {
|
|
3696
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3691
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3697
3692
|
});
|
|
3698
3693
|
});
|
|
3699
3694
|
}
|
|
@@ -3755,7 +3750,7 @@ var OAuthCredential = /** @class */ (function (_super) {
|
|
|
3755
3750
|
cred.secret = params.oauthTokenSecret;
|
|
3756
3751
|
}
|
|
3757
3752
|
else {
|
|
3758
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
3753
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3759
3754
|
}
|
|
3760
3755
|
return cred;
|
|
3761
3756
|
};
|
|
@@ -3861,7 +3856,7 @@ var _a;
|
|
|
3861
3856
|
function signInWithPhoneNumber$1(auth, request) {
|
|
3862
3857
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3863
3858
|
return tslib.__generator(this, function (_a) {
|
|
3864
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3859
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3865
3860
|
});
|
|
3866
3861
|
});
|
|
3867
3862
|
}
|
|
@@ -3870,11 +3865,11 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3870
3865
|
var response;
|
|
3871
3866
|
return tslib.__generator(this, function (_a) {
|
|
3872
3867
|
switch (_a.label) {
|
|
3873
|
-
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3868
|
+
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3874
3869
|
case 1:
|
|
3875
3870
|
response = _a.sent();
|
|
3876
3871
|
if (response.temporaryProof) {
|
|
3877
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
3872
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
3878
3873
|
}
|
|
3879
3874
|
return [2 /*return*/, response];
|
|
3880
3875
|
}
|
|
@@ -3882,14 +3877,14 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3882
3877
|
});
|
|
3883
3878
|
}
|
|
3884
3879
|
var VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = (_a = {},
|
|
3885
|
-
_a["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
3880
|
+
_a["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
3886
3881
|
_a);
|
|
3887
3882
|
function verifyPhoneNumberForExisting(auth, request) {
|
|
3888
3883
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3889
3884
|
var apiRequest;
|
|
3890
3885
|
return tslib.__generator(this, function (_a) {
|
|
3891
3886
|
apiRequest = tslib.__assign(tslib.__assign({}, request), { operation: 'REAUTH' });
|
|
3892
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
3887
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
3893
3888
|
});
|
|
3894
3889
|
});
|
|
3895
3890
|
}
|
|
@@ -3918,7 +3913,7 @@ function verifyPhoneNumberForExisting(auth, request) {
|
|
|
3918
3913
|
var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
3919
3914
|
tslib.__extends(PhoneAuthCredential, _super);
|
|
3920
3915
|
function PhoneAuthCredential(params) {
|
|
3921
|
-
var _this = _super.call(this, "phone" /* PHONE */, "phone" /* PHONE */) || this;
|
|
3916
|
+
var _this = _super.call(this, "phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */) || this;
|
|
3922
3917
|
_this.params = params;
|
|
3923
3918
|
return _this;
|
|
3924
3919
|
}
|
|
@@ -4018,17 +4013,17 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
|
4018
4013
|
function parseMode(mode) {
|
|
4019
4014
|
switch (mode) {
|
|
4020
4015
|
case 'recoverEmail':
|
|
4021
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
4016
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
4022
4017
|
case 'resetPassword':
|
|
4023
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
4018
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
4024
4019
|
case 'signIn':
|
|
4025
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
4020
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
4026
4021
|
case 'verifyEmail':
|
|
4027
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
4022
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
4028
4023
|
case 'verifyAndChangeEmail':
|
|
4029
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
4024
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
4030
4025
|
case 'revertSecondFactorAddition':
|
|
4031
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
4026
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
4032
4027
|
default:
|
|
4033
4028
|
return null;
|
|
4034
4029
|
}
|
|
@@ -4067,17 +4062,17 @@ var ActionCodeURL = /** @class */ (function () {
|
|
|
4067
4062
|
function ActionCodeURL(actionLink) {
|
|
4068
4063
|
var _a, _b, _c, _d, _e, _f;
|
|
4069
4064
|
var searchParams = util.querystringDecode(util.extractQuerystring(actionLink));
|
|
4070
|
-
var apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4071
|
-
var code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4072
|
-
var operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4065
|
+
var apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4066
|
+
var code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4067
|
+
var operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4073
4068
|
// Validate API key, code and mode.
|
|
4074
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
4069
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4075
4070
|
this.apiKey = apiKey;
|
|
4076
4071
|
this.operation = operation;
|
|
4077
4072
|
this.code = code;
|
|
4078
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4079
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4080
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4073
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4074
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4075
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4081
4076
|
}
|
|
4082
4077
|
/**
|
|
4083
4078
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -4182,21 +4177,21 @@ var EmailAuthProvider = /** @class */ (function () {
|
|
|
4182
4177
|
*/
|
|
4183
4178
|
EmailAuthProvider.credentialWithLink = function (email, emailLink) {
|
|
4184
4179
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
4185
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
4180
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4186
4181
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
4187
4182
|
};
|
|
4188
4183
|
/**
|
|
4189
4184
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
4190
4185
|
*/
|
|
4191
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
4186
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
4192
4187
|
/**
|
|
4193
4188
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
4194
4189
|
*/
|
|
4195
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
4190
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
4196
4191
|
/**
|
|
4197
4192
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
4198
4193
|
*/
|
|
4199
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
4194
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
4200
4195
|
return EmailAuthProvider;
|
|
4201
4196
|
}());
|
|
4202
4197
|
|
|
@@ -4313,7 +4308,7 @@ var BaseOAuthProvider = /** @class */ (function (_super) {
|
|
|
4313
4308
|
* Retrieve the current list of OAuth scopes.
|
|
4314
4309
|
*/
|
|
4315
4310
|
BaseOAuthProvider.prototype.getScopes = function () {
|
|
4316
|
-
return tslib.__spreadArray([], this.scopes);
|
|
4311
|
+
return tslib.__spreadArray([], this.scopes, true);
|
|
4317
4312
|
};
|
|
4318
4313
|
return BaseOAuthProvider;
|
|
4319
4314
|
}(FederatedAuthProvider));
|
|
@@ -4368,7 +4363,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4368
4363
|
*/
|
|
4369
4364
|
OAuthProvider.credentialFromJSON = function (json) {
|
|
4370
4365
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
4371
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
4366
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4372
4367
|
return OAuthCredential._fromParams(obj);
|
|
4373
4368
|
};
|
|
4374
4369
|
/**
|
|
@@ -4397,7 +4392,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4397
4392
|
};
|
|
4398
4393
|
/** An internal credential method that accepts more permissive options */
|
|
4399
4394
|
OAuthProvider.prototype._credential = function (params) {
|
|
4400
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
4395
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4401
4396
|
// For OAuthCredential, sign in method is same as providerId.
|
|
4402
4397
|
return OAuthCredential._fromParams(tslib.__assign(tslib.__assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
4403
4398
|
};
|
|
@@ -4506,7 +4501,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4506
4501
|
var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
4507
4502
|
tslib.__extends(FacebookAuthProvider, _super);
|
|
4508
4503
|
function FacebookAuthProvider() {
|
|
4509
|
-
return _super.call(this, "facebook.com" /* FACEBOOK */) || this;
|
|
4504
|
+
return _super.call(this, "facebook.com" /* ProviderId.FACEBOOK */) || this;
|
|
4510
4505
|
}
|
|
4511
4506
|
/**
|
|
4512
4507
|
* Creates a credential for Facebook.
|
|
@@ -4560,9 +4555,9 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4560
4555
|
}
|
|
4561
4556
|
};
|
|
4562
4557
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
4563
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
4558
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
4564
4559
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
4565
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
4560
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
4566
4561
|
return FacebookAuthProvider;
|
|
4567
4562
|
}(BaseOAuthProvider));
|
|
4568
4563
|
|
|
@@ -4626,7 +4621,7 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4626
4621
|
var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
4627
4622
|
tslib.__extends(GoogleAuthProvider, _super);
|
|
4628
4623
|
function GoogleAuthProvider() {
|
|
4629
|
-
var _this = _super.call(this, "google.com" /* GOOGLE */) || this;
|
|
4624
|
+
var _this = _super.call(this, "google.com" /* ProviderId.GOOGLE */) || this;
|
|
4630
4625
|
_this.addScope('profile');
|
|
4631
4626
|
return _this;
|
|
4632
4627
|
}
|
|
@@ -4686,9 +4681,9 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4686
4681
|
}
|
|
4687
4682
|
};
|
|
4688
4683
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
4689
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
4684
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
4690
4685
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
4691
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
4686
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
4692
4687
|
return GoogleAuthProvider;
|
|
4693
4688
|
}(BaseOAuthProvider));
|
|
4694
4689
|
|
|
@@ -4753,7 +4748,7 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4753
4748
|
var GithubAuthProvider = /** @class */ (function (_super) {
|
|
4754
4749
|
tslib.__extends(GithubAuthProvider, _super);
|
|
4755
4750
|
function GithubAuthProvider() {
|
|
4756
|
-
return _super.call(this, "github.com" /* GITHUB */) || this;
|
|
4751
|
+
return _super.call(this, "github.com" /* ProviderId.GITHUB */) || this;
|
|
4757
4752
|
}
|
|
4758
4753
|
/**
|
|
4759
4754
|
* Creates a credential for Github.
|
|
@@ -4800,9 +4795,9 @@ var GithubAuthProvider = /** @class */ (function (_super) {
|
|
|
4800
4795
|
}
|
|
4801
4796
|
};
|
|
4802
4797
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
4803
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
4798
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
4804
4799
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
4805
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
4800
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
4806
4801
|
return GithubAuthProvider;
|
|
4807
4802
|
}(BaseOAuthProvider));
|
|
4808
4803
|
|
|
@@ -4926,10 +4921,8 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4926
4921
|
* @param providerId - SAML provider ID.
|
|
4927
4922
|
*/
|
|
4928
4923
|
function SAMLAuthProvider(providerId) {
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
_this = _super.call(this, providerId) || this;
|
|
4932
|
-
return _this;
|
|
4924
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4925
|
+
return _super.call(this, providerId) || this;
|
|
4933
4926
|
}
|
|
4934
4927
|
/**
|
|
4935
4928
|
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
|
|
@@ -4965,7 +4958,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4965
4958
|
*/
|
|
4966
4959
|
SAMLAuthProvider.credentialFromJSON = function (json) {
|
|
4967
4960
|
var credential = SAMLAuthCredential.fromJSON(json);
|
|
4968
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
4961
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4969
4962
|
return credential;
|
|
4970
4963
|
};
|
|
4971
4964
|
SAMLAuthProvider.samlCredentialFromTaggedObject = function (_a) {
|
|
@@ -5045,7 +5038,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5045
5038
|
var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
5046
5039
|
tslib.__extends(TwitterAuthProvider, _super);
|
|
5047
5040
|
function TwitterAuthProvider() {
|
|
5048
|
-
return _super.call(this, "twitter.com" /* TWITTER */) || this;
|
|
5041
|
+
return _super.call(this, "twitter.com" /* ProviderId.TWITTER */) || this;
|
|
5049
5042
|
}
|
|
5050
5043
|
/**
|
|
5051
5044
|
* Creates a credential for Twitter.
|
|
@@ -5095,9 +5088,9 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5095
5088
|
}
|
|
5096
5089
|
};
|
|
5097
5090
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
5098
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
5091
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
5099
5092
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
5100
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
5093
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
5101
5094
|
return TwitterAuthProvider;
|
|
5102
5095
|
}(BaseOAuthProvider));
|
|
5103
5096
|
|
|
@@ -5120,7 +5113,7 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5120
5113
|
function signUp(auth, request) {
|
|
5121
5114
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5122
5115
|
return tslib.__generator(this, function (_a) {
|
|
5123
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5116
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5124
5117
|
});
|
|
5125
5118
|
});
|
|
5126
5119
|
}
|
|
@@ -5195,7 +5188,7 @@ function providerIdForResponse(response) {
|
|
|
5195
5188
|
return response.providerId;
|
|
5196
5189
|
}
|
|
5197
5190
|
if ('phoneNumber' in response) {
|
|
5198
|
-
return "phone" /* PHONE */;
|
|
5191
|
+
return "phone" /* ProviderId.PHONE */;
|
|
5199
5192
|
}
|
|
5200
5193
|
return null;
|
|
5201
5194
|
}
|
|
@@ -5243,7 +5236,7 @@ function signInAnonymously(auth) {
|
|
|
5243
5236
|
return [2 /*return*/, new UserCredentialImpl({
|
|
5244
5237
|
user: authInternal.currentUser,
|
|
5245
5238
|
providerId: null,
|
|
5246
|
-
operationType: "signIn" /* SIGN_IN */
|
|
5239
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
5247
5240
|
})];
|
|
5248
5241
|
}
|
|
5249
5242
|
return [4 /*yield*/, signUp(authInternal, {
|
|
@@ -5251,7 +5244,7 @@ function signInAnonymously(auth) {
|
|
|
5251
5244
|
})];
|
|
5252
5245
|
case 2:
|
|
5253
5246
|
response = _b.sent();
|
|
5254
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true)];
|
|
5247
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true)];
|
|
5255
5248
|
case 3:
|
|
5256
5249
|
userCredential = _b.sent();
|
|
5257
5250
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -5282,8 +5275,9 @@ function signInAnonymously(auth) {
|
|
|
5282
5275
|
var MultiFactorError = /** @class */ (function (_super) {
|
|
5283
5276
|
tslib.__extends(MultiFactorError, _super);
|
|
5284
5277
|
function MultiFactorError(auth, error, operationType, user) {
|
|
5278
|
+
var _this = this;
|
|
5285
5279
|
var _a;
|
|
5286
|
-
|
|
5280
|
+
_this = _super.call(this, error.code, error.message) || this;
|
|
5287
5281
|
_this.operationType = operationType;
|
|
5288
5282
|
_this.user = user;
|
|
5289
5283
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -5302,11 +5296,11 @@ var MultiFactorError = /** @class */ (function (_super) {
|
|
|
5302
5296
|
return MultiFactorError;
|
|
5303
5297
|
}(util.FirebaseError));
|
|
5304
5298
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
5305
|
-
var idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
5299
|
+
var idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
5306
5300
|
? credential._getReauthenticationResolver(auth)
|
|
5307
5301
|
: credential._getIdTokenResponse(auth);
|
|
5308
5302
|
return idTokenProvider.catch(function (error) {
|
|
5309
|
-
if (error.code === "auth/"
|
|
5303
|
+
if (error.code === "auth/".concat("multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */)) {
|
|
5310
5304
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
5311
5305
|
}
|
|
5312
5306
|
throw error;
|
|
@@ -5389,7 +5383,7 @@ function unlink(user, providerId) {
|
|
|
5389
5383
|
userInternal.providerData = userInternal.providerData.filter(function (pd) {
|
|
5390
5384
|
return providersLeft.has(pd.providerId);
|
|
5391
5385
|
});
|
|
5392
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
5386
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
5393
5387
|
userInternal.phoneNumber = null;
|
|
5394
5388
|
}
|
|
5395
5389
|
return [4 /*yield*/, userInternal.auth._persistUserIfCurrent(userInternal)];
|
|
@@ -5412,10 +5406,11 @@ function _link(user, credential, bypassAuthState) {
|
|
|
5412
5406
|
_d = (_c = credential)._linkToIdToken;
|
|
5413
5407
|
_e = [user.auth];
|
|
5414
5408
|
return [4 /*yield*/, user.getIdToken()];
|
|
5415
|
-
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5409
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5410
|
+
bypassAuthState]))];
|
|
5416
5411
|
case 2:
|
|
5417
5412
|
response = _f.sent();
|
|
5418
|
-
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* LINK */, response)];
|
|
5413
|
+
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response)];
|
|
5419
5414
|
}
|
|
5420
5415
|
});
|
|
5421
5416
|
});
|
|
@@ -5430,8 +5425,8 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5430
5425
|
_a.sent();
|
|
5431
5426
|
providerIds = providerDataAsNames(user.providerData);
|
|
5432
5427
|
code = expected === false
|
|
5433
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
5434
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
5428
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
5429
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
5435
5430
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
5436
5431
|
return [2 /*return*/];
|
|
5437
5432
|
}
|
|
@@ -5456,32 +5451,31 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5456
5451
|
* limitations under the License.
|
|
5457
5452
|
*/
|
|
5458
5453
|
function _reauthenticate(user, credential, bypassAuthState) {
|
|
5459
|
-
var _a;
|
|
5460
5454
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
5461
5455
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5462
5456
|
var auth, operationType, response, parsed, localId, e_1;
|
|
5463
|
-
return tslib.__generator(this, function (
|
|
5464
|
-
switch (
|
|
5457
|
+
return tslib.__generator(this, function (_a) {
|
|
5458
|
+
switch (_a.label) {
|
|
5465
5459
|
case 0:
|
|
5466
5460
|
auth = user.auth;
|
|
5467
|
-
operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
5468
|
-
|
|
5461
|
+
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
5462
|
+
_a.label = 1;
|
|
5469
5463
|
case 1:
|
|
5470
|
-
|
|
5464
|
+
_a.trys.push([1, 3, , 4]);
|
|
5471
5465
|
return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
|
|
5472
5466
|
case 2:
|
|
5473
|
-
response =
|
|
5474
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5467
|
+
response = _a.sent();
|
|
5468
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5475
5469
|
parsed = _parseToken(response.idToken);
|
|
5476
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5470
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5477
5471
|
localId = parsed.sub;
|
|
5478
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5472
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5479
5473
|
return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
|
|
5480
5474
|
case 3:
|
|
5481
|
-
e_1 =
|
|
5475
|
+
e_1 = _a.sent();
|
|
5482
5476
|
// Convert user deleted error into user mismatch
|
|
5483
|
-
if ((
|
|
5484
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5477
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/".concat("user-not-found" /* AuthErrorCode.USER_DELETED */)) {
|
|
5478
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5485
5479
|
}
|
|
5486
5480
|
throw e_1;
|
|
5487
5481
|
case 4: return [2 /*return*/];
|
|
@@ -5513,7 +5507,7 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
5513
5507
|
return tslib.__generator(this, function (_a) {
|
|
5514
5508
|
switch (_a.label) {
|
|
5515
5509
|
case 0:
|
|
5516
|
-
operationType = "signIn" /* SIGN_IN */;
|
|
5510
|
+
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
5517
5511
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
5518
5512
|
case 1:
|
|
5519
5513
|
response = _a.sent();
|
|
@@ -5613,7 +5607,7 @@ function reauthenticateWithCredential(user, credential) {
|
|
|
5613
5607
|
function signInWithCustomToken$1(auth, request) {
|
|
5614
5608
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5615
5609
|
return tslib.__generator(this, function (_a) {
|
|
5616
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5610
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5617
5611
|
});
|
|
5618
5612
|
});
|
|
5619
5613
|
}
|
|
@@ -5663,7 +5657,7 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
5663
5657
|
})];
|
|
5664
5658
|
case 1:
|
|
5665
5659
|
response = _a.sent();
|
|
5666
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5660
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5667
5661
|
case 2:
|
|
5668
5662
|
cred = _a.sent();
|
|
5669
5663
|
return [4 /*yield*/, authInternal._updateCurrentUser(cred.user)];
|
|
@@ -5702,14 +5696,14 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
5702
5696
|
if ('phoneInfo' in enrollment) {
|
|
5703
5697
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
5704
5698
|
}
|
|
5705
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5699
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5706
5700
|
};
|
|
5707
5701
|
return MultiFactorInfoImpl;
|
|
5708
5702
|
}());
|
|
5709
5703
|
var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
5710
5704
|
tslib.__extends(PhoneMultiFactorInfoImpl, _super);
|
|
5711
5705
|
function PhoneMultiFactorInfoImpl(response) {
|
|
5712
|
-
var _this = _super.call(this, "phone" /* PHONE */, response) || this;
|
|
5706
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */, response) || this;
|
|
5713
5707
|
_this.phoneNumber = response.phoneInfo;
|
|
5714
5708
|
return _this;
|
|
5715
5709
|
}
|
|
@@ -5737,18 +5731,18 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
5737
5731
|
*/
|
|
5738
5732
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
5739
5733
|
var _a;
|
|
5740
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
5734
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
5741
5735
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
5742
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5736
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5743
5737
|
request.continueUrl = actionCodeSettings.url;
|
|
5744
5738
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
5745
5739
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
5746
5740
|
if (actionCodeSettings.iOS) {
|
|
5747
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
5741
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
5748
5742
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
5749
5743
|
}
|
|
5750
5744
|
if (actionCodeSettings.android) {
|
|
5751
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
5745
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
5752
5746
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
5753
5747
|
request.androidMinimumVersionCode =
|
|
5754
5748
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -5812,7 +5806,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
5812
5806
|
case 0:
|
|
5813
5807
|
authModular = util.getModularInstance(auth);
|
|
5814
5808
|
request = {
|
|
5815
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
5809
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5816
5810
|
email: email
|
|
5817
5811
|
};
|
|
5818
5812
|
if (actionCodeSettings) {
|
|
@@ -5891,18 +5885,18 @@ function checkActionCode(auth, oobCode) {
|
|
|
5891
5885
|
case 1:
|
|
5892
5886
|
response = _a.sent();
|
|
5893
5887
|
operation = response.requestType;
|
|
5894
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5888
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5895
5889
|
switch (operation) {
|
|
5896
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
5890
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
5897
5891
|
break;
|
|
5898
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
5899
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5892
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
5893
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5900
5894
|
break;
|
|
5901
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
5902
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5895
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
5896
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5903
5897
|
// fall through
|
|
5904
5898
|
default:
|
|
5905
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5899
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5906
5900
|
}
|
|
5907
5901
|
multiFactorInfo = null;
|
|
5908
5902
|
if (response.mfaInfo) {
|
|
@@ -5910,10 +5904,10 @@ function checkActionCode(auth, oobCode) {
|
|
|
5910
5904
|
}
|
|
5911
5905
|
return [2 /*return*/, {
|
|
5912
5906
|
data: {
|
|
5913
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5907
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5914
5908
|
? response.newEmail
|
|
5915
5909
|
: response.email) || null,
|
|
5916
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5910
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5917
5911
|
? response.email
|
|
5918
5912
|
: response.newEmail) || null,
|
|
5919
5913
|
multiFactorInfo: multiFactorInfo
|
|
@@ -5979,7 +5973,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5979
5973
|
})];
|
|
5980
5974
|
case 1:
|
|
5981
5975
|
response = _a.sent();
|
|
5982
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5976
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5983
5977
|
case 2:
|
|
5984
5978
|
userCredential = _a.sent();
|
|
5985
5979
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -6072,10 +6066,10 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6072
6066
|
case 0:
|
|
6073
6067
|
authModular = util.getModularInstance(auth);
|
|
6074
6068
|
request = {
|
|
6075
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
6069
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
6076
6070
|
email: email
|
|
6077
6071
|
};
|
|
6078
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6072
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6079
6073
|
if (actionCodeSettings) {
|
|
6080
6074
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
6081
6075
|
}
|
|
@@ -6097,7 +6091,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6097
6091
|
*/
|
|
6098
6092
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
6099
6093
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
6100
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
6094
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
6101
6095
|
}
|
|
6102
6096
|
/**
|
|
6103
6097
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -6144,7 +6138,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6144
6138
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
6145
6139
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
6146
6140
|
// instance.
|
|
6147
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
6141
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
6148
6142
|
return [2 /*return*/, signInWithCredential(authModular, credential)];
|
|
6149
6143
|
});
|
|
6150
6144
|
});
|
|
@@ -6169,7 +6163,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6169
6163
|
function createAuthUri(auth, request) {
|
|
6170
6164
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6171
6165
|
return tslib.__generator(this, function (_a) {
|
|
6172
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6166
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6173
6167
|
});
|
|
6174
6168
|
});
|
|
6175
6169
|
}
|
|
@@ -6264,7 +6258,7 @@ function sendEmailVerification(user, actionCodeSettings) {
|
|
|
6264
6258
|
case 1:
|
|
6265
6259
|
idToken = _a.sent();
|
|
6266
6260
|
request = {
|
|
6267
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
6261
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
6268
6262
|
idToken: idToken
|
|
6269
6263
|
};
|
|
6270
6264
|
if (actionCodeSettings) {
|
|
@@ -6328,7 +6322,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6328
6322
|
case 1:
|
|
6329
6323
|
idToken = _a.sent();
|
|
6330
6324
|
request = {
|
|
6331
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
6325
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
6332
6326
|
idToken: idToken,
|
|
6333
6327
|
newEmail: newEmail
|
|
6334
6328
|
};
|
|
@@ -6372,7 +6366,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6372
6366
|
function updateProfile$1(auth, request) {
|
|
6373
6367
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6374
6368
|
return tslib.__generator(this, function (_a) {
|
|
6375
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
6369
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
6376
6370
|
});
|
|
6377
6371
|
});
|
|
6378
6372
|
}
|
|
@@ -6428,7 +6422,7 @@ function updateProfile(user, _a) {
|
|
|
6428
6422
|
userInternal.photoURL = response.photoUrl || null;
|
|
6429
6423
|
passwordProvider = userInternal.providerData.find(function (_a) {
|
|
6430
6424
|
var providerId = _a.providerId;
|
|
6431
|
-
return providerId === "password" /* PASSWORD */;
|
|
6425
|
+
return providerId === "password" /* ProviderId.PASSWORD */;
|
|
6432
6426
|
});
|
|
6433
6427
|
if (passwordProvider) {
|
|
6434
6428
|
passwordProvider.displayName = userInternal.displayName;
|
|
@@ -6539,12 +6533,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6539
6533
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
6540
6534
|
: {};
|
|
6541
6535
|
var isNewUser = idTokenResponse.isNewUser ||
|
|
6542
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
6536
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
6543
6537
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
6544
6538
|
var signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];
|
|
6545
6539
|
if (signInProvider) {
|
|
6546
|
-
var filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
6547
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
6540
|
+
var filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
6541
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
6548
6542
|
? signInProvider
|
|
6549
6543
|
: null;
|
|
6550
6544
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -6555,16 +6549,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6555
6549
|
return null;
|
|
6556
6550
|
}
|
|
6557
6551
|
switch (providerId) {
|
|
6558
|
-
case "facebook.com" /* FACEBOOK */:
|
|
6552
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
6559
6553
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
6560
|
-
case "github.com" /* GITHUB */:
|
|
6554
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
6561
6555
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
6562
|
-
case "google.com" /* GOOGLE */:
|
|
6556
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
6563
6557
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
6564
|
-
case "twitter.com" /* TWITTER */:
|
|
6558
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
6565
6559
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
6566
|
-
case "custom" /* CUSTOM */:
|
|
6567
|
-
case "anonymous" /* ANONYMOUS */:
|
|
6560
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
6561
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
6568
6562
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
6569
6563
|
default:
|
|
6570
6564
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -6591,28 +6585,28 @@ var FederatedAdditionalUserInfoWithUsername = /** @class */ (function (_super) {
|
|
|
6591
6585
|
var FacebookAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6592
6586
|
tslib.__extends(FacebookAdditionalUserInfo, _super);
|
|
6593
6587
|
function FacebookAdditionalUserInfo(isNewUser, profile) {
|
|
6594
|
-
return _super.call(this, isNewUser, "facebook.com" /* FACEBOOK */, profile) || this;
|
|
6588
|
+
return _super.call(this, isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile) || this;
|
|
6595
6589
|
}
|
|
6596
6590
|
return FacebookAdditionalUserInfo;
|
|
6597
6591
|
}(GenericAdditionalUserInfo));
|
|
6598
6592
|
var GithubAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6599
6593
|
tslib.__extends(GithubAdditionalUserInfo, _super);
|
|
6600
6594
|
function GithubAdditionalUserInfo(isNewUser, profile) {
|
|
6601
|
-
return _super.call(this, isNewUser, "github.com" /* GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
6595
|
+
return _super.call(this, isNewUser, "github.com" /* ProviderId.GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
6602
6596
|
}
|
|
6603
6597
|
return GithubAdditionalUserInfo;
|
|
6604
6598
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
6605
6599
|
var GoogleAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6606
6600
|
tslib.__extends(GoogleAdditionalUserInfo, _super);
|
|
6607
6601
|
function GoogleAdditionalUserInfo(isNewUser, profile) {
|
|
6608
|
-
return _super.call(this, isNewUser, "google.com" /* GOOGLE */, profile) || this;
|
|
6602
|
+
return _super.call(this, isNewUser, "google.com" /* ProviderId.GOOGLE */, profile) || this;
|
|
6609
6603
|
}
|
|
6610
6604
|
return GoogleAdditionalUserInfo;
|
|
6611
6605
|
}(GenericAdditionalUserInfo));
|
|
6612
6606
|
var TwitterAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6613
6607
|
tslib.__extends(TwitterAdditionalUserInfo, _super);
|
|
6614
6608
|
function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {
|
|
6615
|
-
return _super.call(this, isNewUser, "twitter.com" /* TWITTER */, profile, screenName) || this;
|
|
6609
|
+
return _super.call(this, isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName) || this;
|
|
6616
6610
|
}
|
|
6617
6611
|
return TwitterAdditionalUserInfo;
|
|
6618
6612
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
@@ -6795,14 +6789,14 @@ var MultiFactorSessionImpl = /** @class */ (function () {
|
|
|
6795
6789
|
this.auth = auth;
|
|
6796
6790
|
}
|
|
6797
6791
|
MultiFactorSessionImpl._fromIdtoken = function (idToken, auth) {
|
|
6798
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
6792
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
6799
6793
|
};
|
|
6800
6794
|
MultiFactorSessionImpl._fromMfaPendingCredential = function (mfaPendingCredential) {
|
|
6801
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
6795
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
6802
6796
|
};
|
|
6803
6797
|
MultiFactorSessionImpl.prototype.toJSON = function () {
|
|
6804
6798
|
var _a;
|
|
6805
|
-
var key = this.type === "enroll" /* ENROLL */
|
|
6799
|
+
var key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
6806
6800
|
? 'idToken'
|
|
6807
6801
|
: 'pendingCredential';
|
|
6808
6802
|
return {
|
|
@@ -6856,7 +6850,7 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6856
6850
|
var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
|
|
6857
6851
|
return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
6858
6852
|
});
|
|
6859
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6853
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6860
6854
|
var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
6861
6855
|
return new MultiFactorResolverImpl(session, hints, function (assertion) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
6862
6856
|
var mfaResponse, idTokenResponse, _a, userCredential;
|
|
@@ -6871,8 +6865,8 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6871
6865
|
idTokenResponse = tslib.__assign(tslib.__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
6872
6866
|
_a = error.operationType;
|
|
6873
6867
|
switch (_a) {
|
|
6874
|
-
case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
|
|
6875
|
-
case "reauthenticate" /* REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6868
|
+
case "signIn" /* OperationType.SIGN_IN */: return [3 /*break*/, 2];
|
|
6869
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6876
6870
|
}
|
|
6877
6871
|
return [3 /*break*/, 6];
|
|
6878
6872
|
case 2: return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse)];
|
|
@@ -6883,10 +6877,10 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6883
6877
|
_b.sent();
|
|
6884
6878
|
return [2 /*return*/, userCredential];
|
|
6885
6879
|
case 5:
|
|
6886
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6880
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6887
6881
|
return [2 /*return*/, UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse)];
|
|
6888
6882
|
case 6:
|
|
6889
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6883
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6890
6884
|
_b.label = 7;
|
|
6891
6885
|
case 7: return [2 /*return*/];
|
|
6892
6886
|
}
|
|
@@ -6918,8 +6912,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6918
6912
|
var _a;
|
|
6919
6913
|
var authModular = util.getModularInstance(auth);
|
|
6920
6914
|
var errorInternal = error;
|
|
6921
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6922
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6915
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6916
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6923
6917
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
6924
6918
|
}
|
|
6925
6919
|
|
|
@@ -6940,7 +6934,7 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6940
6934
|
* limitations under the License.
|
|
6941
6935
|
*/
|
|
6942
6936
|
function withdrawMfa(auth, request) {
|
|
6943
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6937
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6944
6938
|
}
|
|
6945
6939
|
|
|
6946
6940
|
var MultiFactorUserImpl = /** @class */ (function () {
|
|
@@ -7001,22 +6995,21 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7001
6995
|
});
|
|
7002
6996
|
};
|
|
7003
6997
|
MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
|
|
7004
|
-
var _a;
|
|
7005
6998
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
7006
6999
|
var mfaEnrollmentId, idToken, idTokenResponse, e_1;
|
|
7007
|
-
return tslib.__generator(this, function (
|
|
7008
|
-
switch (
|
|
7000
|
+
return tslib.__generator(this, function (_a) {
|
|
7001
|
+
switch (_a.label) {
|
|
7009
7002
|
case 0:
|
|
7010
7003
|
mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
7011
7004
|
return [4 /*yield*/, this.user.getIdToken()];
|
|
7012
7005
|
case 1:
|
|
7013
|
-
idToken =
|
|
7006
|
+
idToken = _a.sent();
|
|
7014
7007
|
return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
7015
7008
|
idToken: idToken,
|
|
7016
7009
|
mfaEnrollmentId: mfaEnrollmentId
|
|
7017
7010
|
}))];
|
|
7018
7011
|
case 2:
|
|
7019
|
-
idTokenResponse =
|
|
7012
|
+
idTokenResponse = _a.sent();
|
|
7020
7013
|
// Remove the second factor from the user's list.
|
|
7021
7014
|
this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
|
|
7022
7015
|
var uid = _a.uid;
|
|
@@ -7032,17 +7025,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7032
7025
|
// the tokenResponse may be empty. If the tokens were not updated (and they
|
|
7033
7026
|
// are now invalid), reloading the user will discover this and invalidate
|
|
7034
7027
|
// the user's state accordingly.
|
|
7035
|
-
|
|
7036
|
-
|
|
7028
|
+
_a.sent();
|
|
7029
|
+
_a.label = 4;
|
|
7037
7030
|
case 4:
|
|
7038
|
-
|
|
7031
|
+
_a.trys.push([4, 6, , 7]);
|
|
7039
7032
|
return [4 /*yield*/, this.user.reload()];
|
|
7040
7033
|
case 5:
|
|
7041
|
-
|
|
7034
|
+
_a.sent();
|
|
7042
7035
|
return [3 /*break*/, 7];
|
|
7043
7036
|
case 6:
|
|
7044
|
-
e_1 =
|
|
7045
|
-
if ((
|
|
7037
|
+
e_1 = _a.sent();
|
|
7038
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
|
|
7046
7039
|
throw e_1;
|
|
7047
7040
|
}
|
|
7048
7041
|
return [3 /*break*/, 7];
|
|
@@ -7073,7 +7066,7 @@ function multiFactor(user) {
|
|
|
7073
7066
|
}
|
|
7074
7067
|
|
|
7075
7068
|
var name = "@firebase/auth";
|
|
7076
|
-
var version = "0.
|
|
7069
|
+
var version = "0.21.0";
|
|
7077
7070
|
|
|
7078
7071
|
/**
|
|
7079
7072
|
* @license
|
|
@@ -7128,8 +7121,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7128
7121
|
return;
|
|
7129
7122
|
}
|
|
7130
7123
|
var unsubscribe = this.auth.onIdTokenChanged(function (user) {
|
|
7131
|
-
|
|
7132
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
7124
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
7133
7125
|
});
|
|
7134
7126
|
this.internalListeners.set(listener, unsubscribe);
|
|
7135
7127
|
this.updateProactiveRefresh();
|
|
@@ -7145,7 +7137,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7145
7137
|
this.updateProactiveRefresh();
|
|
7146
7138
|
};
|
|
7147
7139
|
AuthInterop.prototype.assertAuthConfigured = function () {
|
|
7148
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7140
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7149
7141
|
};
|
|
7150
7142
|
AuthInterop.prototype.updateProactiveRefresh = function () {
|
|
7151
7143
|
if (this.internalListeners.size > 0) {
|
|
@@ -7176,13 +7168,13 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7176
7168
|
*/
|
|
7177
7169
|
function getVersionForPlatform(clientPlatform) {
|
|
7178
7170
|
switch (clientPlatform) {
|
|
7179
|
-
case "Node" /* NODE */:
|
|
7171
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
7180
7172
|
return 'node';
|
|
7181
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
7173
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
7182
7174
|
return 'rn';
|
|
7183
|
-
case "Worker" /* WORKER */:
|
|
7175
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
7184
7176
|
return 'webworker';
|
|
7185
|
-
case "Cordova" /* CORDOVA */:
|
|
7177
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
7186
7178
|
return 'cordova';
|
|
7187
7179
|
default:
|
|
7188
7180
|
return undefined;
|
|
@@ -7190,48 +7182,48 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
7190
7182
|
}
|
|
7191
7183
|
/** @internal */
|
|
7192
7184
|
function registerAuth(clientPlatform) {
|
|
7193
|
-
app._registerComponent(new component.Component("auth" /* AUTH */, function (container, _a) {
|
|
7185
|
+
app._registerComponent(new component.Component("auth" /* _ComponentName.AUTH */, function (container, _a) {
|
|
7194
7186
|
var deps = _a.options;
|
|
7195
7187
|
var app = container.getProvider('app').getImmediate();
|
|
7196
7188
|
var heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
7197
7189
|
var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
|
|
7198
7190
|
return (function (app, heartbeatServiceProvider) {
|
|
7199
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
7191
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
7200
7192
|
// Auth domain is optional if IdP sign in isn't being used
|
|
7201
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
7193
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
7202
7194
|
appName: app.name
|
|
7203
7195
|
});
|
|
7204
7196
|
var config = {
|
|
7205
7197
|
apiKey: apiKey,
|
|
7206
7198
|
authDomain: authDomain,
|
|
7207
7199
|
clientPlatform: clientPlatform,
|
|
7208
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
7209
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
7210
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
7200
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
7201
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
7202
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
7211
7203
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
7212
7204
|
};
|
|
7213
7205
|
var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
7214
7206
|
_initializeAuthInstance(authInstance, deps);
|
|
7215
7207
|
return authInstance;
|
|
7216
7208
|
})(app, heartbeatServiceProvider);
|
|
7217
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
7209
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
7218
7210
|
/**
|
|
7219
7211
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
7220
7212
|
* For why we do this, See go/firebase-next-auth-init
|
|
7221
7213
|
*/
|
|
7222
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
7214
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
7223
7215
|
/**
|
|
7224
7216
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
7225
7217
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
7226
7218
|
*/
|
|
7227
7219
|
.setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {
|
|
7228
|
-
var authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
7220
|
+
var authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
7229
7221
|
authInternalProvider.initialize();
|
|
7230
7222
|
}));
|
|
7231
|
-
app._registerComponent(new component.Component("auth-internal" /* AUTH_INTERNAL */, function (container) {
|
|
7232
|
-
var auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
7223
|
+
app._registerComponent(new component.Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, function (container) {
|
|
7224
|
+
var auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
7233
7225
|
return (function (auth) { return new AuthInterop(auth); })(auth);
|
|
7234
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
7226
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
7235
7227
|
app.registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
7236
7228
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
7237
7229
|
app.registerVersion(name, version, 'cjs5');
|
|
@@ -7266,11 +7258,11 @@ function getAuth(app$1) {
|
|
|
7266
7258
|
var auth = initializeAuth(app$1);
|
|
7267
7259
|
var authEmulatorHost = util.getDefaultEmulatorHost('auth');
|
|
7268
7260
|
if (authEmulatorHost) {
|
|
7269
|
-
connectAuthEmulator(auth, "http://"
|
|
7261
|
+
connectAuthEmulator(auth, "http://".concat(authEmulatorHost));
|
|
7270
7262
|
}
|
|
7271
7263
|
return auth;
|
|
7272
7264
|
}
|
|
7273
|
-
registerAuth("Node" /* NODE */);
|
|
7265
|
+
registerAuth("Node" /* ClientPlatform.NODE */);
|
|
7274
7266
|
// The rest of this file contains no-ops and errors for browser-specific
|
|
7275
7267
|
// methods. We keep the browser and Node entry points the same, but features
|
|
7276
7268
|
// that only work in browsers are set to either do nothing (setPersistence) or
|
|
@@ -7278,7 +7270,7 @@ registerAuth("Node" /* NODE */);
|
|
|
7278
7270
|
// The below exports are pulled into the main entry point by a rollup alias
|
|
7279
7271
|
// plugin (overwriting the default browser imports).
|
|
7280
7272
|
/** auth/operation-not-supported-in-this-environment */
|
|
7281
|
-
var NOT_AVAILABLE_ERROR = _createError("operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
7273
|
+
var NOT_AVAILABLE_ERROR = _createError("operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
7282
7274
|
/** Reject with auth/operation-not-supported-in-this-environment */
|
|
7283
7275
|
function fail() {
|
|
7284
7276
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
@@ -7435,4 +7427,4 @@ exports.updateProfile = updateProfile;
|
|
|
7435
7427
|
exports.useDeviceLanguage = useDeviceLanguage;
|
|
7436
7428
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
7437
7429
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
7438
|
-
//# sourceMappingURL=index-
|
|
7430
|
+
//# sourceMappingURL=index-2efb81c0.js.map
|