@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
|
@@ -121,147 +121,147 @@ var ActionCodeOperation = {
|
|
|
121
121
|
function _debugErrorMap() {
|
|
122
122
|
var _a;
|
|
123
123
|
return _a = {},
|
|
124
|
-
_a["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
125
|
-
_a["argument-error" /* ARGUMENT_ERROR */] = '',
|
|
126
|
-
_a["app-not-authorized" /* APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
124
|
+
_a["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
125
|
+
_a["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */] = '',
|
|
126
|
+
_a["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
127
127
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
128
128
|
'Review your key configuration in the Google API console.',
|
|
129
|
-
_a["app-not-installed" /* APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
129
|
+
_a["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
130
130
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
131
131
|
'this device.',
|
|
132
|
-
_a["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
132
|
+
_a["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
133
133
|
'already used or the domain associated with it does not match the list ' +
|
|
134
134
|
'of whitelisted domains.',
|
|
135
|
-
_a["code-expired" /* CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
135
|
+
_a["code-expired" /* AuthErrorCode.CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
136
136
|
'again.',
|
|
137
|
-
_a["cordova-not-ready" /* CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
138
|
-
_a["cors-unsupported" /* CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
139
|
-
_a["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
140
|
-
_a["custom-token-mismatch" /* CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
141
|
-
_a["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
137
|
+
_a["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
138
|
+
_a["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
139
|
+
_a["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
140
|
+
_a["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
141
|
+
_a["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
142
142
|
'again before retrying this request.',
|
|
143
|
-
_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 ' +
|
|
143
|
+
_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 ' +
|
|
144
144
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
145
145
|
'starting any other Firebase SDK.',
|
|
146
|
-
_a["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
146
|
+
_a["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
147
147
|
'conditions.',
|
|
148
|
-
_a["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
149
|
-
_a["email-already-in-use" /* EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
150
|
-
_a["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
148
|
+
_a["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
149
|
+
_a["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
150
|
+
_a["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
151
151
|
'no longer be configured to use the emulator. Try calling ' +
|
|
152
152
|
'"connectAuthEmulator()" sooner.',
|
|
153
|
-
_a["expired-action-code" /* EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
154
|
-
_a["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
155
|
-
_a["internal-error" /* INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
156
|
-
_a["invalid-app-credential" /* INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
153
|
+
_a["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
154
|
+
_a["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
155
|
+
_a["internal-error" /* AuthErrorCode.INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
156
|
+
_a["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
157
157
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
158
|
-
_a["invalid-app-id" /* INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
159
|
-
_a["invalid-user-token" /* INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
158
|
+
_a["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
159
|
+
_a["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
160
160
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
161
161
|
'the project associated with this API key.',
|
|
162
|
-
_a["invalid-auth-event" /* INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
163
|
-
_a["invalid-verification-code" /* INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
162
|
+
_a["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
163
|
+
_a["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
164
164
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
165
165
|
'verification code provided by the user.',
|
|
166
|
-
_a["invalid-continue-uri" /* INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
167
|
-
_a["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
166
|
+
_a["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
167
|
+
_a["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
168
168
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
169
169
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
170
170
|
'cordova-plugin-customurlscheme.',
|
|
171
|
-
_a["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
172
|
-
_a["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
173
|
-
_a["invalid-email" /* INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
174
|
-
_a["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
175
|
-
_a["invalid-api-key" /* INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
176
|
-
_a["invalid-cert-hash" /* INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
177
|
-
_a["invalid-credential" /* INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
178
|
-
_a["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
171
|
+
_a["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
172
|
+
_a["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
173
|
+
_a["invalid-email" /* AuthErrorCode.INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
174
|
+
_a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
175
|
+
_a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
176
|
+
_a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
177
|
+
_a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
178
|
+
_a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
179
179
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
180
|
-
_a["invalid-multi-factor-session" /* INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
181
|
-
_a["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
180
|
+
_a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
181
|
+
_a["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
182
182
|
'only supports OAuth providers.',
|
|
183
|
-
_a["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
183
|
+
_a["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
184
184
|
'specified API key.',
|
|
185
|
-
_a["unauthorized-domain" /* INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
185
|
+
_a["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
186
186
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
187
|
-
_a["invalid-action-code" /* INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
187
|
+
_a["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
188
188
|
'expired, or has already been used.',
|
|
189
|
-
_a["wrong-password" /* INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
190
|
-
_a["invalid-persistence-type" /* INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
191
|
-
_a["invalid-phone-number" /* INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
189
|
+
_a["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
190
|
+
_a["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
191
|
+
_a["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
192
192
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
193
193
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
194
194
|
'number including area code].',
|
|
195
|
-
_a["invalid-provider-id" /* INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
196
|
-
_a["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
195
|
+
_a["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
196
|
+
_a["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
197
197
|
'recipient email address is invalid.',
|
|
198
|
-
_a["invalid-sender" /* INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
198
|
+
_a["invalid-sender" /* AuthErrorCode.INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
199
199
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
200
|
-
_a["invalid-verification-id" /* INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
201
|
-
_a["invalid-tenant-id" /* INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
202
|
-
_a["login-blocked" /* LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
203
|
-
_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.',
|
|
204
|
-
_a["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
200
|
+
_a["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
201
|
+
_a["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
202
|
+
_a["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
203
|
+
_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.',
|
|
204
|
+
_a["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
205
205
|
'by following the instructions in the Firebase console.',
|
|
206
|
-
_a["missing-app-credential" /* MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
206
|
+
_a["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
207
207
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
208
|
-
_a["missing-verification-code" /* MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
209
|
-
_a["missing-continue-uri" /* MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
210
|
-
_a["missing-iframe-start" /* MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
211
|
-
_a["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
212
|
-
_a["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
208
|
+
_a["missing-verification-code" /* AuthErrorCode.MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
209
|
+
_a["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
210
|
+
_a["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
211
|
+
_a["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
212
|
+
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
213
213
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
214
214
|
'in the ID token payload.',
|
|
215
|
-
_a["missing-multi-factor-info" /* MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
216
|
-
_a["missing-multi-factor-session" /* MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
217
|
-
_a["missing-phone-number" /* MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
218
|
-
_a["missing-verification-id" /* MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
219
|
-
_a["app-deleted" /* MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
220
|
-
_a["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
221
|
-
_a["multi-factor-auth-required" /* MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
222
|
-
_a["account-exists-with-different-credential" /* NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
215
|
+
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
216
|
+
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
217
|
+
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
218
|
+
_a["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
219
|
+
_a["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
220
|
+
_a["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
221
|
+
_a["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
222
|
+
_a["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
223
223
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
224
224
|
'email address.',
|
|
225
|
-
_a["network-request-failed" /* NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
226
|
-
_a["no-auth-event" /* NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
227
|
-
_a["no-such-provider" /* NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
228
|
-
_a["null-user" /* NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
225
|
+
_a["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
226
|
+
_a["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
227
|
+
_a["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
228
|
+
_a["null-user" /* AuthErrorCode.NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
229
229
|
'requires a non-null user object.',
|
|
230
|
-
_a["operation-not-allowed" /* OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
230
|
+
_a["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
231
231
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
232
232
|
'Auth section.',
|
|
233
|
-
_a["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
233
|
+
_a["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
234
234
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
235
235
|
' and web storage must be enabled.',
|
|
236
|
-
_a["popup-blocked" /* POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
237
|
-
_a["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
238
|
-
_a["provider-already-linked" /* PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
239
|
-
_a["quota-exceeded" /* QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
240
|
-
_a["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
241
|
-
_a["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
242
|
-
_a["rejected-credential" /* REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
243
|
-
_a["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
244
|
-
_a["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
245
|
-
_a["tenant-id-mismatch" /* TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
246
|
-
_a["timeout" /* TIMEOUT */] = 'The operation has timed out.',
|
|
247
|
-
_a["user-token-expired" /* TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
248
|
-
_a["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
236
|
+
_a["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
237
|
+
_a["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
238
|
+
_a["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
239
|
+
_a["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
240
|
+
_a["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
241
|
+
_a["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
242
|
+
_a["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
243
|
+
_a["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
244
|
+
_a["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
245
|
+
_a["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
246
|
+
_a["timeout" /* AuthErrorCode.TIMEOUT */] = 'The operation has timed out.',
|
|
247
|
+
_a["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
248
|
+
_a["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
249
249
|
'Try again later.',
|
|
250
|
-
_a["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
250
|
+
_a["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
251
251
|
'the domain in the Firebase console.',
|
|
252
|
-
_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.',
|
|
253
|
-
_a["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
254
|
-
_a["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
255
|
-
_a["unverified-email" /* UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
256
|
-
_a["user-cancelled" /* USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
257
|
-
_a["user-not-found" /* USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
252
|
+
_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.',
|
|
253
|
+
_a["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
254
|
+
_a["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
255
|
+
_a["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
256
|
+
_a["user-cancelled" /* AuthErrorCode.USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
257
|
+
_a["user-not-found" /* AuthErrorCode.USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
258
258
|
'have been deleted.',
|
|
259
|
-
_a["user-disabled" /* USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
260
|
-
_a["user-mismatch" /* USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
261
|
-
_a["user-signed-out" /* USER_SIGNED_OUT */] = '',
|
|
262
|
-
_a["weak-password" /* WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
263
|
-
_a["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
264
|
-
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
259
|
+
_a["user-disabled" /* AuthErrorCode.USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
260
|
+
_a["user-mismatch" /* AuthErrorCode.USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
261
|
+
_a["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */] = '',
|
|
262
|
+
_a["weak-password" /* AuthErrorCode.WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
263
|
+
_a["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
264
|
+
_a["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
265
265
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
266
266
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
267
267
|
' already initialized instance.',
|
|
@@ -273,7 +273,7 @@ function _prodErrorMap() {
|
|
|
273
273
|
// nature of this error, developers will never be able to see the message
|
|
274
274
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
275
275
|
return _a = {},
|
|
276
|
-
_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 ' +
|
|
276
|
+
_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 ' +
|
|
277
277
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
278
278
|
'starting any other Firebase SDK.',
|
|
279
279
|
_a;
|
|
@@ -427,7 +427,7 @@ function _logError(msg) {
|
|
|
427
427
|
args[_i - 1] = arguments[_i];
|
|
428
428
|
}
|
|
429
429
|
if (logClient.logLevel <= LogLevel.ERROR) {
|
|
430
|
-
logClient.error.apply(logClient, __spreadArray(["Auth ("
|
|
430
|
+
logClient.error.apply(logClient, __spreadArray(["Auth (".concat(SDK_VERSION, "): ").concat(msg)], args, false));
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
|
|
@@ -452,14 +452,14 @@ function _fail(authOrCode) {
|
|
|
452
452
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
453
453
|
rest[_i - 1] = arguments[_i];
|
|
454
454
|
}
|
|
455
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
455
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
456
456
|
}
|
|
457
457
|
function _createError(authOrCode) {
|
|
458
458
|
var rest = [];
|
|
459
459
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
460
460
|
rest[_i - 1] = arguments[_i];
|
|
461
461
|
}
|
|
462
|
-
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
462
|
+
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
463
463
|
}
|
|
464
464
|
function _errorWithCustomMessage(auth, code, message) {
|
|
465
465
|
var _a;
|
|
@@ -473,9 +473,9 @@ function _assertInstanceOf(auth, object, instance) {
|
|
|
473
473
|
var constructorInstance = instance;
|
|
474
474
|
if (!(object instanceof constructorInstance)) {
|
|
475
475
|
if (constructorInstance.name !== object.constructor.name) {
|
|
476
|
-
_fail(auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
476
|
+
_fail(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
477
477
|
}
|
|
478
|
-
throw _errorWithCustomMessage(auth, "argument-error" /* ARGUMENT_ERROR */, "Type of "
|
|
478
|
+
throw _errorWithCustomMessage(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, "Type of ".concat(object.constructor.name, " does not match expected instance.") +
|
|
479
479
|
"Did you pass a reference from a different Auth SDK?");
|
|
480
480
|
}
|
|
481
481
|
}
|
|
@@ -487,13 +487,13 @@ function createErrorInternal(authOrCode) {
|
|
|
487
487
|
}
|
|
488
488
|
if (typeof authOrCode !== 'string') {
|
|
489
489
|
var code = rest[0];
|
|
490
|
-
var fullParams = __spreadArray([], rest.slice(1));
|
|
490
|
+
var fullParams = __spreadArray([], rest.slice(1), true);
|
|
491
491
|
if (fullParams[0]) {
|
|
492
492
|
fullParams[0].appName = authOrCode.name;
|
|
493
493
|
}
|
|
494
|
-
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams));
|
|
494
|
+
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams, false));
|
|
495
495
|
}
|
|
496
|
-
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest));
|
|
496
|
+
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest, false));
|
|
497
497
|
}
|
|
498
498
|
function _assert(assertion, authOrCode) {
|
|
499
499
|
var rest = [];
|
|
@@ -501,7 +501,7 @@ function _assert(assertion, authOrCode) {
|
|
|
501
501
|
rest[_i - 2] = arguments[_i];
|
|
502
502
|
}
|
|
503
503
|
if (!assertion) {
|
|
504
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
504
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
/**
|
|
@@ -612,7 +612,7 @@ function initializeAuth(app, deps) {
|
|
|
612
612
|
return auth_1;
|
|
613
613
|
}
|
|
614
614
|
else {
|
|
615
|
-
_fail(auth_1, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
615
|
+
_fail(auth_1, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
var auth = provider.initialize({ options: deps });
|
|
@@ -740,7 +740,7 @@ var Delay = /** @class */ (function () {
|
|
|
740
740
|
Delay.prototype.get = function () {
|
|
741
741
|
if (!_isOnline()) {
|
|
742
742
|
// Pick the shorter timeout.
|
|
743
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
743
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
744
744
|
}
|
|
745
745
|
// If running in a mobile environment, return the long delay, otherwise
|
|
746
746
|
// return the short delay.
|
|
@@ -773,7 +773,7 @@ function _emulatorUrl(config, path) {
|
|
|
773
773
|
if (!path) {
|
|
774
774
|
return url;
|
|
775
775
|
}
|
|
776
|
-
return ""
|
|
776
|
+
return "".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
/**
|
|
@@ -856,64 +856,64 @@ var _a$1;
|
|
|
856
856
|
*/
|
|
857
857
|
var SERVER_ERROR_MAP = (_a$1 = {},
|
|
858
858
|
// Custom token errors.
|
|
859
|
-
_a$1["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
859
|
+
_a$1["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
860
860
|
// This can only happen if the SDK sends a bad request.
|
|
861
|
-
_a$1["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */] = "internal-error" /* INTERNAL_ERROR */,
|
|
861
|
+
_a$1["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
862
862
|
// Create Auth URI errors.
|
|
863
|
-
_a$1["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */] = "invalid-email" /* INVALID_EMAIL */,
|
|
863
|
+
_a$1["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */] = "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
864
864
|
// This can only happen if the SDK sends a bad request.
|
|
865
|
-
_a$1["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */] = "internal-error" /* INTERNAL_ERROR */,
|
|
865
|
+
_a$1["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
866
866
|
// Sign in with email and password errors (some apply to sign up too).
|
|
867
|
-
_a$1["INVALID_PASSWORD" /* INVALID_PASSWORD */] = "wrong-password" /* INVALID_PASSWORD */,
|
|
867
|
+
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
868
868
|
// This can only happen if the SDK sends a bad request.
|
|
869
|
-
_a$1["MISSING_PASSWORD" /* MISSING_PASSWORD */] = "internal-error" /* INTERNAL_ERROR */,
|
|
869
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
870
870
|
// Sign up with email and password errors.
|
|
871
|
-
_a$1["EMAIL_EXISTS" /* EMAIL_EXISTS */] = "email-already-in-use" /* EMAIL_EXISTS */,
|
|
872
|
-
_a$1["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
871
|
+
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
872
|
+
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
873
873
|
// Verify assertion for sign in with credential errors:
|
|
874
|
-
_a$1["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
875
|
-
_a$1["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
876
|
-
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
874
|
+
_a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
875
|
+
_a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
876
|
+
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
877
877
|
// This can only happen if the SDK sends a bad request.
|
|
878
|
-
_a$1["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
878
|
+
_a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
879
879
|
// Send Password reset email errors:
|
|
880
|
-
_a$1["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
881
|
-
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
882
|
-
_a$1["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */] = "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
883
|
-
_a$1["INVALID_OOB_CODE" /* INVALID_OOB_CODE */] = "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
880
|
+
_a$1["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
881
|
+
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
882
|
+
_a$1["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */] = "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
883
|
+
_a$1["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */] = "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
884
884
|
// This can only happen if the SDK sends a bad request.
|
|
885
|
-
_a$1["MISSING_OOB_CODE" /* MISSING_OOB_CODE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
885
|
+
_a$1["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
886
886
|
// Operations that require ID token in request:
|
|
887
|
-
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
888
|
-
_a$1["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */] = "invalid-user-token" /* INVALID_AUTH */,
|
|
889
|
-
_a$1["TOKEN_EXPIRED" /* TOKEN_EXPIRED */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
890
|
-
_a$1["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
887
|
+
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
888
|
+
_a$1["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */] = "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
889
|
+
_a$1["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
890
|
+
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
891
891
|
// Other errors.
|
|
892
|
-
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
892
|
+
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
893
893
|
// Phone Auth related errors.
|
|
894
|
-
_a$1["INVALID_CODE" /* INVALID_CODE */] = "invalid-verification-code" /* INVALID_CODE */,
|
|
895
|
-
_a$1["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */] = "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
896
|
-
_a$1["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
897
|
-
_a$1["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */] = "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
898
|
-
_a$1["SESSION_EXPIRED" /* SESSION_EXPIRED */] = "code-expired" /* CODE_EXPIRED */,
|
|
894
|
+
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
895
|
+
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
896
|
+
_a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
897
|
+
_a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
898
|
+
_a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
899
899
|
// Other action code errors when additional settings passed.
|
|
900
900
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
901
901
|
// This is OK as this error will be caught by client side validation.
|
|
902
|
-
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
903
|
-
_a$1["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
902
|
+
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
903
|
+
_a$1["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
904
904
|
// getProjectConfig errors when clientId is passed.
|
|
905
|
-
_a$1["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
905
|
+
_a$1["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
906
906
|
// User actions (sign-up or deletion) disabled errors.
|
|
907
|
-
_a$1["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
907
|
+
_a$1["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
908
908
|
// Multi factor related errors.
|
|
909
|
-
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
910
|
-
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
911
|
-
_a$1["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
912
|
-
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
913
|
-
_a$1["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
914
|
-
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
909
|
+
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
910
|
+
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
911
|
+
_a$1["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
912
|
+
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
913
|
+
_a$1["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
914
|
+
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
915
915
|
// Blocking functions related errors.
|
|
916
|
-
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
916
|
+
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
917
917
|
_a$1);
|
|
918
918
|
|
|
919
919
|
/**
|
|
@@ -952,7 +952,7 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
952
952
|
body = {};
|
|
953
953
|
params = {};
|
|
954
954
|
if (request) {
|
|
955
|
-
if (method === "GET" /* GET */) {
|
|
955
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
956
956
|
params = request;
|
|
957
957
|
}
|
|
958
958
|
else {
|
|
@@ -965,12 +965,11 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
965
965
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
966
966
|
case 1:
|
|
967
967
|
headers = _a.sent();
|
|
968
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
968
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
969
969
|
if (auth.languageCode) {
|
|
970
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
970
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
971
971
|
}
|
|
972
|
-
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method,
|
|
973
|
-
headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
972
|
+
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method, headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
974
973
|
}
|
|
975
974
|
});
|
|
976
975
|
}); })];
|
|
@@ -1002,7 +1001,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1002
1001
|
case 3:
|
|
1003
1002
|
json = _b.sent();
|
|
1004
1003
|
if ('needConfirmation' in json) {
|
|
1005
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
1004
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
1006
1005
|
}
|
|
1007
1006
|
if (response.ok && !('errorMessage' in json)) {
|
|
1008
1007
|
return [2 /*return*/, json];
|
|
@@ -1010,14 +1009,14 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1010
1009
|
else {
|
|
1011
1010
|
errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
1012
1011
|
_a = errorMessage.split(' : '), serverErrorCode = _a[0], serverErrorMessage = _a[1];
|
|
1013
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1014
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1012
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1013
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1015
1014
|
}
|
|
1016
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
1017
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
1015
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
1016
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
1018
1017
|
}
|
|
1019
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
1020
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
1018
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
1019
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
1021
1020
|
}
|
|
1022
1021
|
authError = errorMap[serverErrorCode] ||
|
|
1023
1022
|
serverErrorCode
|
|
@@ -1036,7 +1035,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1036
1035
|
if (e_1 instanceof FirebaseError) {
|
|
1037
1036
|
throw e_1;
|
|
1038
1037
|
}
|
|
1039
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
1038
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
1040
1039
|
return [3 /*break*/, 5];
|
|
1041
1040
|
case 5: return [2 /*return*/];
|
|
1042
1041
|
}
|
|
@@ -1053,7 +1052,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1053
1052
|
case 1:
|
|
1054
1053
|
serverResponse = (_a.sent());
|
|
1055
1054
|
if ('mfaPendingCredential' in serverResponse) {
|
|
1056
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
1055
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
1057
1056
|
_serverResponse: serverResponse
|
|
1058
1057
|
});
|
|
1059
1058
|
}
|
|
@@ -1063,9 +1062,9 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1063
1062
|
});
|
|
1064
1063
|
}
|
|
1065
1064
|
function _getFinalTarget(auth, host, path, query) {
|
|
1066
|
-
var base = ""
|
|
1065
|
+
var base = "".concat(host).concat(path, "?").concat(query);
|
|
1067
1066
|
if (!auth.config.emulator) {
|
|
1068
|
-
return auth.config.apiScheme
|
|
1067
|
+
return "".concat(auth.config.apiScheme, "://").concat(base);
|
|
1069
1068
|
}
|
|
1070
1069
|
return _emulatorUrl(auth.config, base);
|
|
1071
1070
|
}
|
|
@@ -1079,7 +1078,7 @@ var NetworkTimeout = /** @class */ (function () {
|
|
|
1079
1078
|
this.timer = null;
|
|
1080
1079
|
this.promise = new Promise(function (_, reject) {
|
|
1081
1080
|
_this.timer = setTimeout(function () {
|
|
1082
|
-
return reject(_createError(_this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1081
|
+
return reject(_createError(_this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1083
1082
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1084
1083
|
});
|
|
1085
1084
|
}
|
|
@@ -1123,21 +1122,21 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1123
1122
|
function deleteAccount(auth, request) {
|
|
1124
1123
|
return __awaiter(this, void 0, void 0, function () {
|
|
1125
1124
|
return __generator(this, function (_a) {
|
|
1126
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request)];
|
|
1125
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request)];
|
|
1127
1126
|
});
|
|
1128
1127
|
});
|
|
1129
1128
|
}
|
|
1130
1129
|
function deleteLinkedAccounts(auth, request) {
|
|
1131
1130
|
return __awaiter(this, void 0, void 0, function () {
|
|
1132
1131
|
return __generator(this, function (_a) {
|
|
1133
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
1132
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
1134
1133
|
});
|
|
1135
1134
|
});
|
|
1136
1135
|
}
|
|
1137
1136
|
function getAccountInfo(auth, request) {
|
|
1138
1137
|
return __awaiter(this, void 0, void 0, function () {
|
|
1139
1138
|
return __generator(this, function (_a) {
|
|
1140
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request)];
|
|
1139
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request)];
|
|
1141
1140
|
});
|
|
1142
1141
|
});
|
|
1143
1142
|
}
|
|
@@ -1233,7 +1232,7 @@ function getIdTokenResult(user, forceRefresh) {
|
|
|
1233
1232
|
case 1:
|
|
1234
1233
|
token = _a.sent();
|
|
1235
1234
|
claims = _parseToken(token);
|
|
1236
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1235
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1237
1236
|
firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1238
1237
|
signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1239
1238
|
return [2 /*return*/, {
|
|
@@ -1253,8 +1252,7 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1253
1252
|
return Number(seconds) * 1000;
|
|
1254
1253
|
}
|
|
1255
1254
|
function _parseToken(token) {
|
|
1256
|
-
var _a;
|
|
1257
|
-
var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
|
|
1255
|
+
var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
|
|
1258
1256
|
if (algorithm === undefined ||
|
|
1259
1257
|
payload === undefined ||
|
|
1260
1258
|
signature === undefined) {
|
|
@@ -1270,7 +1268,7 @@ function _parseToken(token) {
|
|
|
1270
1268
|
return JSON.parse(decoded);
|
|
1271
1269
|
}
|
|
1272
1270
|
catch (e) {
|
|
1273
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1271
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1274
1272
|
return null;
|
|
1275
1273
|
}
|
|
1276
1274
|
}
|
|
@@ -1279,9 +1277,9 @@ function _parseToken(token) {
|
|
|
1279
1277
|
*/
|
|
1280
1278
|
function _tokenExpiresIn(token) {
|
|
1281
1279
|
var parsedToken = _parseToken(token);
|
|
1282
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1283
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1284
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1280
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1281
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1282
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1285
1283
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1286
1284
|
}
|
|
1287
1285
|
|
|
@@ -1332,8 +1330,8 @@ function _logoutIfInvalidated(user, promise, bypassAuthState) {
|
|
|
1332
1330
|
}
|
|
1333
1331
|
function isUserInvalidated(_a) {
|
|
1334
1332
|
var code = _a.code;
|
|
1335
|
-
return (code === "auth/"
|
|
1336
|
-
code === "auth/"
|
|
1333
|
+
return (code === "auth/".concat("user-disabled" /* AuthErrorCode.USER_DISABLED */) ||
|
|
1334
|
+
code === "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */));
|
|
1337
1335
|
}
|
|
1338
1336
|
|
|
1339
1337
|
/**
|
|
@@ -1361,7 +1359,7 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1361
1359
|
// we can't cast properly in both environments.
|
|
1362
1360
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1363
1361
|
this.timerId = null;
|
|
1364
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1362
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1365
1363
|
}
|
|
1366
1364
|
ProactiveRefresh.prototype._start = function () {
|
|
1367
1365
|
if (this.isRunning) {
|
|
@@ -1383,14 +1381,14 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1383
1381
|
var _a;
|
|
1384
1382
|
if (wasError) {
|
|
1385
1383
|
var interval = this.errorBackoff;
|
|
1386
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1384
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1387
1385
|
return interval;
|
|
1388
1386
|
}
|
|
1389
1387
|
else {
|
|
1390
1388
|
// Reset the error backoff
|
|
1391
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1389
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1392
1390
|
var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1393
|
-
var interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1391
|
+
var interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1394
1392
|
return Math.max(0, interval);
|
|
1395
1393
|
}
|
|
1396
1394
|
};
|
|
@@ -1414,22 +1412,21 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1414
1412
|
}); }, interval);
|
|
1415
1413
|
};
|
|
1416
1414
|
ProactiveRefresh.prototype.iteration = function () {
|
|
1417
|
-
var _a;
|
|
1418
1415
|
return __awaiter(this, void 0, void 0, function () {
|
|
1419
1416
|
var e_1;
|
|
1420
|
-
return __generator(this, function (
|
|
1421
|
-
switch (
|
|
1417
|
+
return __generator(this, function (_a) {
|
|
1418
|
+
switch (_a.label) {
|
|
1422
1419
|
case 0:
|
|
1423
|
-
|
|
1420
|
+
_a.trys.push([0, 2, , 3]);
|
|
1424
1421
|
return [4 /*yield*/, this.user.getIdToken(true)];
|
|
1425
1422
|
case 1:
|
|
1426
|
-
|
|
1423
|
+
_a.sent();
|
|
1427
1424
|
return [3 /*break*/, 3];
|
|
1428
1425
|
case 2:
|
|
1429
|
-
e_1 =
|
|
1426
|
+
e_1 = _a.sent();
|
|
1430
1427
|
// Only retry on network errors
|
|
1431
|
-
if ((
|
|
1432
|
-
"auth/"
|
|
1428
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) ===
|
|
1429
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
1433
1430
|
this.schedule(/* wasError */ true);
|
|
1434
1431
|
}
|
|
1435
1432
|
return [2 /*return*/];
|
|
@@ -1513,7 +1510,7 @@ function _reloadWithoutSaving(user) {
|
|
|
1513
1510
|
return [4 /*yield*/, _logoutIfInvalidated(user, getAccountInfo(auth, { idToken: idToken }))];
|
|
1514
1511
|
case 2:
|
|
1515
1512
|
response = _b.sent();
|
|
1516
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1513
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1517
1514
|
coreAccount = response.users[0];
|
|
1518
1515
|
user._notifyReloadListener(coreAccount);
|
|
1519
1516
|
newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1575,7 +1572,7 @@ function reload(user) {
|
|
|
1575
1572
|
}
|
|
1576
1573
|
function mergeProviderData(original, newData) {
|
|
1577
1574
|
var deduped = original.filter(function (o) { return !newData.some(function (n) { return n.providerId === o.providerId; }); });
|
|
1578
|
-
return __spreadArray(__spreadArray([], deduped), newData);
|
|
1575
|
+
return __spreadArray(__spreadArray([], deduped, true), newData, true);
|
|
1579
1576
|
}
|
|
1580
1577
|
function extractProviderData(providers) {
|
|
1581
1578
|
return providers.map(function (_a) {
|
|
@@ -1623,13 +1620,13 @@ function requestStsToken(auth, refreshToken) {
|
|
|
1623
1620
|
'refresh_token': refreshToken
|
|
1624
1621
|
}).slice(1);
|
|
1625
1622
|
_a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
|
|
1626
|
-
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key="
|
|
1623
|
+
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, "key=".concat(apiKey));
|
|
1627
1624
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1628
1625
|
case 1:
|
|
1629
1626
|
headers = _b.sent();
|
|
1630
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1627
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1631
1628
|
return [2 /*return*/, FetchProvider.fetch()(url, {
|
|
1632
|
-
method: "POST" /* POST */,
|
|
1629
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1633
1630
|
headers: headers,
|
|
1634
1631
|
body: body
|
|
1635
1632
|
})];
|
|
@@ -1680,15 +1677,15 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1680
1677
|
Object.defineProperty(StsTokenManager.prototype, "isExpired", {
|
|
1681
1678
|
get: function () {
|
|
1682
1679
|
return (!this.expirationTime ||
|
|
1683
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1680
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1684
1681
|
},
|
|
1685
1682
|
enumerable: false,
|
|
1686
1683
|
configurable: true
|
|
1687
1684
|
});
|
|
1688
1685
|
StsTokenManager.prototype.updateFromServerResponse = function (response) {
|
|
1689
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1690
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1691
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1686
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1687
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1688
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1692
1689
|
var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1693
1690
|
? Number(response.expiresIn)
|
|
1694
1691
|
: _tokenExpiresIn(response.idToken);
|
|
@@ -1700,7 +1697,7 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1700
1697
|
return __generator(this, function (_a) {
|
|
1701
1698
|
switch (_a.label) {
|
|
1702
1699
|
case 0:
|
|
1703
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1700
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1704
1701
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1705
1702
|
return [2 /*return*/, this.accessToken];
|
|
1706
1703
|
}
|
|
@@ -1740,19 +1737,19 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1740
1737
|
var refreshToken = object.refreshToken, accessToken = object.accessToken, expirationTime = object.expirationTime;
|
|
1741
1738
|
var manager = new StsTokenManager();
|
|
1742
1739
|
if (refreshToken) {
|
|
1743
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1740
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1744
1741
|
appName: appName
|
|
1745
1742
|
});
|
|
1746
1743
|
manager.refreshToken = refreshToken;
|
|
1747
1744
|
}
|
|
1748
1745
|
if (accessToken) {
|
|
1749
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1746
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1750
1747
|
appName: appName
|
|
1751
1748
|
});
|
|
1752
1749
|
manager.accessToken = accessToken;
|
|
1753
1750
|
}
|
|
1754
1751
|
if (expirationTime) {
|
|
1755
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1752
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1756
1753
|
appName: appName
|
|
1757
1754
|
});
|
|
1758
1755
|
manager.expirationTime = expirationTime;
|
|
@@ -1797,13 +1794,13 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1797
1794
|
* limitations under the License.
|
|
1798
1795
|
*/
|
|
1799
1796
|
function assertStringOrUndefined(assertion, appName) {
|
|
1800
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName: appName });
|
|
1797
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName: appName });
|
|
1801
1798
|
}
|
|
1802
1799
|
var UserImpl = /** @class */ (function () {
|
|
1803
1800
|
function UserImpl(_a) {
|
|
1804
1801
|
var uid = _a.uid, auth = _a.auth, stsTokenManager = _a.stsTokenManager, opt = __rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1805
1802
|
// For the user object, provider is always Firebase.
|
|
1806
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1803
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1807
1804
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1808
1805
|
this.reloadUserInfo = null;
|
|
1809
1806
|
this.reloadListener = null;
|
|
@@ -1818,7 +1815,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1818
1815
|
this.photoURL = opt.photoURL || null;
|
|
1819
1816
|
this.isAnonymous = opt.isAnonymous || false;
|
|
1820
1817
|
this.tenantId = opt.tenantId || null;
|
|
1821
|
-
this.providerData = opt.providerData ? __spreadArray([], opt.providerData) : [];
|
|
1818
|
+
this.providerData = opt.providerData ? __spreadArray([], opt.providerData, true) : [];
|
|
1822
1819
|
this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);
|
|
1823
1820
|
}
|
|
1824
1821
|
UserImpl.prototype.getIdToken = function (forceRefresh) {
|
|
@@ -1829,7 +1826,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1829
1826
|
case 0: return [4 /*yield*/, _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh))];
|
|
1830
1827
|
case 1:
|
|
1831
1828
|
accessToken = _a.sent();
|
|
1832
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1829
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1833
1830
|
if (!(this.accessToken !== accessToken)) return [3 /*break*/, 3];
|
|
1834
1831
|
this.accessToken = accessToken;
|
|
1835
1832
|
return [4 /*yield*/, this.auth._persistUserIfCurrent(this)];
|
|
@@ -1852,7 +1849,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1852
1849
|
if (this === user) {
|
|
1853
1850
|
return;
|
|
1854
1851
|
}
|
|
1855
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1852
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1856
1853
|
this.displayName = user.displayName;
|
|
1857
1854
|
this.photoURL = user.photoURL;
|
|
1858
1855
|
this.email = user.email;
|
|
@@ -1869,7 +1866,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1869
1866
|
};
|
|
1870
1867
|
UserImpl.prototype._onReload = function (callback) {
|
|
1871
1868
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1872
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1869
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1873
1870
|
this.reloadListener = callback;
|
|
1874
1871
|
if (this.reloadUserInfo) {
|
|
1875
1872
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -1965,13 +1962,13 @@ var UserImpl = /** @class */ (function () {
|
|
|
1965
1962
|
var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1966
1963
|
var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
1967
1964
|
var uid = object.uid, emailVerified = object.emailVerified, isAnonymous = object.isAnonymous, providerData = object.providerData, plainObjectTokenManager = object.stsTokenManager;
|
|
1968
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1965
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1969
1966
|
var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
1970
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1967
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1971
1968
|
assertStringOrUndefined(displayName, auth.name);
|
|
1972
1969
|
assertStringOrUndefined(email, auth.name);
|
|
1973
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1974
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1970
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1971
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1975
1972
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
1976
1973
|
assertStringOrUndefined(photoURL, auth.name);
|
|
1977
1974
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -2051,7 +2048,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2051
2048
|
*/
|
|
2052
2049
|
var InMemoryPersistence = /** @class */ (function () {
|
|
2053
2050
|
function InMemoryPersistence() {
|
|
2054
|
-
this.type = "NONE" /* NONE */;
|
|
2051
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
2055
2052
|
this.storage = {};
|
|
2056
2053
|
}
|
|
2057
2054
|
InMemoryPersistence.prototype._isAvailable = function () {
|
|
@@ -2121,7 +2118,7 @@ var inMemoryPersistence = InMemoryPersistence;
|
|
|
2121
2118
|
* limitations under the License.
|
|
2122
2119
|
*/
|
|
2123
2120
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
2124
|
-
return "firebase" /* PERSISTENCE
|
|
2121
|
+
return "".concat("firebase" /* Namespace.PERSISTENCE */, ":").concat(key, ":").concat(apiKey, ":").concat(appName);
|
|
2125
2122
|
}
|
|
2126
2123
|
var PersistenceUserManager = /** @class */ (function () {
|
|
2127
2124
|
function PersistenceUserManager(persistence, auth, userKey) {
|
|
@@ -2130,7 +2127,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2130
2127
|
this.userKey = userKey;
|
|
2131
2128
|
var _a = this.auth, config = _a.config, name = _a.name;
|
|
2132
2129
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
2133
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
2130
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
2134
2131
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
2135
2132
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
2136
2133
|
}
|
|
@@ -2184,7 +2181,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2184
2181
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
2185
2182
|
};
|
|
2186
2183
|
PersistenceUserManager.create = function (auth, persistenceHierarchy, userKey) {
|
|
2187
|
-
if (userKey === void 0) { userKey = "authUser" /* AUTH_USER */; }
|
|
2184
|
+
if (userKey === void 0) { userKey = "authUser" /* KeyName.AUTH_USER */; }
|
|
2188
2185
|
return __awaiter(this, void 0, void 0, function () {
|
|
2189
2186
|
var availablePersistences, selectedPersistence, key, userToMigrate, _i, persistenceHierarchy_1, persistence, blob, user, migrationHierarchy;
|
|
2190
2187
|
var _this = this;
|
|
@@ -2311,42 +2308,42 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2311
2308
|
function _getBrowserName(userAgent) {
|
|
2312
2309
|
var ua = userAgent.toLowerCase();
|
|
2313
2310
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
2314
|
-
return "Opera" /* OPERA */;
|
|
2311
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
2315
2312
|
}
|
|
2316
2313
|
else if (_isIEMobile(ua)) {
|
|
2317
2314
|
// Windows phone IEMobile browser.
|
|
2318
|
-
return "IEMobile" /* IEMOBILE */;
|
|
2315
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
2319
2316
|
}
|
|
2320
2317
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
2321
|
-
return "IE" /* IE */;
|
|
2318
|
+
return "IE" /* BrowserName.IE */;
|
|
2322
2319
|
}
|
|
2323
2320
|
else if (ua.includes('edge/')) {
|
|
2324
|
-
return "Edge" /* EDGE */;
|
|
2321
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
2325
2322
|
}
|
|
2326
2323
|
else if (_isFirefox(ua)) {
|
|
2327
|
-
return "Firefox" /* FIREFOX */;
|
|
2324
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
2328
2325
|
}
|
|
2329
2326
|
else if (ua.includes('silk/')) {
|
|
2330
|
-
return "Silk" /* SILK */;
|
|
2327
|
+
return "Silk" /* BrowserName.SILK */;
|
|
2331
2328
|
}
|
|
2332
2329
|
else if (_isBlackBerry(ua)) {
|
|
2333
2330
|
// Blackberry browser.
|
|
2334
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
2331
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
2335
2332
|
}
|
|
2336
2333
|
else if (_isWebOS(ua)) {
|
|
2337
2334
|
// WebOS default browser.
|
|
2338
|
-
return "Webos" /* WEBOS */;
|
|
2335
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
2339
2336
|
}
|
|
2340
2337
|
else if (_isSafari(ua)) {
|
|
2341
|
-
return "Safari" /* SAFARI */;
|
|
2338
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
2342
2339
|
}
|
|
2343
2340
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
2344
2341
|
!ua.includes('edge/')) {
|
|
2345
|
-
return "Chrome" /* CHROME */;
|
|
2342
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
2346
2343
|
}
|
|
2347
2344
|
else if (_isAndroid(ua)) {
|
|
2348
2345
|
// Android stock browser.
|
|
2349
|
-
return "Android" /* ANDROID */;
|
|
2346
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
2350
2347
|
}
|
|
2351
2348
|
else {
|
|
2352
2349
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -2356,7 +2353,7 @@ function _getBrowserName(userAgent) {
|
|
|
2356
2353
|
return matches[1];
|
|
2357
2354
|
}
|
|
2358
2355
|
}
|
|
2359
|
-
return "Other" /* OTHER */;
|
|
2356
|
+
return "Other" /* BrowserName.OTHER */;
|
|
2360
2357
|
}
|
|
2361
2358
|
function _isFirefox(ua) {
|
|
2362
2359
|
if (ua === void 0) { ua = getUA(); }
|
|
@@ -2452,15 +2449,15 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2452
2449
|
if (frameworks === void 0) { frameworks = []; }
|
|
2453
2450
|
var reportedPlatform;
|
|
2454
2451
|
switch (clientPlatform) {
|
|
2455
|
-
case "Browser" /* BROWSER */:
|
|
2452
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
2456
2453
|
// In a browser environment, report the browser name.
|
|
2457
2454
|
reportedPlatform = _getBrowserName(getUA());
|
|
2458
2455
|
break;
|
|
2459
|
-
case "Worker" /* WORKER */:
|
|
2456
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
2460
2457
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
2461
2458
|
// worker from a browser.
|
|
2462
2459
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
2463
|
-
reportedPlatform = _getBrowserName(getUA())
|
|
2460
|
+
reportedPlatform = "".concat(_getBrowserName(getUA()), "-").concat(clientPlatform);
|
|
2464
2461
|
break;
|
|
2465
2462
|
default:
|
|
2466
2463
|
reportedPlatform = clientPlatform;
|
|
@@ -2468,7 +2465,7 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2468
2465
|
var reportedFrameworks = frameworks.length
|
|
2469
2466
|
? frameworks.join(',')
|
|
2470
2467
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
2471
|
-
return reportedPlatform
|
|
2468
|
+
return "".concat(reportedPlatform, "/").concat("JsCore" /* ClientImplementation.CORE */, "/").concat(SDK_VERSION, "/").concat(reportedFrameworks);
|
|
2472
2469
|
}
|
|
2473
2470
|
|
|
2474
2471
|
/**
|
|
@@ -2521,43 +2518,42 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2521
2518
|
};
|
|
2522
2519
|
};
|
|
2523
2520
|
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2524
|
-
var _a;
|
|
2525
2521
|
return __awaiter(this, void 0, void 0, function () {
|
|
2526
|
-
var onAbortStack, _i,
|
|
2527
|
-
return __generator(this, function (
|
|
2528
|
-
switch (
|
|
2522
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2523
|
+
return __generator(this, function (_c) {
|
|
2524
|
+
switch (_c.label) {
|
|
2529
2525
|
case 0:
|
|
2530
2526
|
if (this.auth.currentUser === nextUser) {
|
|
2531
2527
|
return [2 /*return*/];
|
|
2532
2528
|
}
|
|
2533
2529
|
onAbortStack = [];
|
|
2534
|
-
|
|
2530
|
+
_c.label = 1;
|
|
2535
2531
|
case 1:
|
|
2536
|
-
|
|
2537
|
-
_i = 0,
|
|
2538
|
-
|
|
2532
|
+
_c.trys.push([1, 6, , 7]);
|
|
2533
|
+
_i = 0, _a = this.queue;
|
|
2534
|
+
_c.label = 2;
|
|
2539
2535
|
case 2:
|
|
2540
|
-
if (!(_i <
|
|
2541
|
-
beforeStateCallback =
|
|
2536
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2537
|
+
beforeStateCallback = _a[_i];
|
|
2542
2538
|
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2543
2539
|
case 3:
|
|
2544
|
-
|
|
2540
|
+
_c.sent();
|
|
2545
2541
|
// Only push the onAbort if the callback succeeds
|
|
2546
2542
|
if (beforeStateCallback.onAbort) {
|
|
2547
2543
|
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2548
2544
|
}
|
|
2549
|
-
|
|
2545
|
+
_c.label = 4;
|
|
2550
2546
|
case 4:
|
|
2551
2547
|
_i++;
|
|
2552
2548
|
return [3 /*break*/, 2];
|
|
2553
2549
|
case 5: return [3 /*break*/, 7];
|
|
2554
2550
|
case 6:
|
|
2555
|
-
e_1 =
|
|
2551
|
+
e_1 = _c.sent();
|
|
2556
2552
|
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2557
2553
|
// continue
|
|
2558
2554
|
onAbortStack.reverse();
|
|
2559
|
-
for (
|
|
2560
|
-
onAbort = onAbortStack_1[
|
|
2555
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2556
|
+
onAbort = onAbortStack_1[_b];
|
|
2561
2557
|
try {
|
|
2562
2558
|
onAbort();
|
|
2563
2559
|
}
|
|
@@ -2565,8 +2561,8 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2565
2561
|
/* swallow error */
|
|
2566
2562
|
}
|
|
2567
2563
|
}
|
|
2568
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2569
|
-
originalMessage:
|
|
2564
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2565
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2570
2566
|
});
|
|
2571
2567
|
case 7: return [2 /*return*/];
|
|
2572
2568
|
}
|
|
@@ -2776,7 +2772,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2776
2772
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
2777
2773
|
}
|
|
2778
2774
|
case 9:
|
|
2779
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2775
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2780
2776
|
return [4 /*yield*/, this.getOrInitRedirectPersistenceManager()];
|
|
2781
2777
|
case 10:
|
|
2782
2778
|
_b.sent();
|
|
@@ -2824,21 +2820,20 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2824
2820
|
});
|
|
2825
2821
|
};
|
|
2826
2822
|
AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
|
|
2827
|
-
var _a;
|
|
2828
2823
|
return __awaiter(this, void 0, void 0, function () {
|
|
2829
2824
|
var e_4;
|
|
2830
|
-
return __generator(this, function (
|
|
2831
|
-
switch (
|
|
2825
|
+
return __generator(this, function (_a) {
|
|
2826
|
+
switch (_a.label) {
|
|
2832
2827
|
case 0:
|
|
2833
|
-
|
|
2828
|
+
_a.trys.push([0, 2, , 3]);
|
|
2834
2829
|
return [4 /*yield*/, _reloadWithoutSaving(user)];
|
|
2835
2830
|
case 1:
|
|
2836
|
-
|
|
2831
|
+
_a.sent();
|
|
2837
2832
|
return [3 /*break*/, 3];
|
|
2838
2833
|
case 2:
|
|
2839
|
-
e_4 =
|
|
2840
|
-
if ((
|
|
2841
|
-
"auth/"
|
|
2834
|
+
e_4 = _a.sent();
|
|
2835
|
+
if ((e_4 === null || e_4 === void 0 ? void 0 : e_4.code) !==
|
|
2836
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
2842
2837
|
// Something's wrong with the user's token. Log them out and remove
|
|
2843
2838
|
// them from storage
|
|
2844
2839
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
@@ -2868,7 +2863,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2868
2863
|
? getModularInstance(userExtern)
|
|
2869
2864
|
: null;
|
|
2870
2865
|
if (user) {
|
|
2871
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2866
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2872
2867
|
}
|
|
2873
2868
|
return [2 /*return*/, this._updateCurrentUser(user && user._clone(this))];
|
|
2874
2869
|
});
|
|
@@ -2885,7 +2880,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2885
2880
|
return [2 /*return*/];
|
|
2886
2881
|
}
|
|
2887
2882
|
if (user) {
|
|
2888
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2883
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2889
2884
|
}
|
|
2890
2885
|
if (!!skipBeforeStateCallbacks) return [3 /*break*/, 2];
|
|
2891
2886
|
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(user)];
|
|
@@ -2991,9 +2986,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2991
2986
|
if (!!this.redirectPersistenceManager) return [3 /*break*/, 3];
|
|
2992
2987
|
resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
2993
2988
|
this._popupRedirectResolver;
|
|
2994
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2989
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2995
2990
|
_a = this;
|
|
2996
|
-
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */)];
|
|
2991
|
+
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */)];
|
|
2997
2992
|
case 1:
|
|
2998
2993
|
_a.redirectPersistenceManager = _c.sent();
|
|
2999
2994
|
_b = this;
|
|
@@ -3053,7 +3048,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3053
3048
|
}
|
|
3054
3049
|
};
|
|
3055
3050
|
AuthImpl.prototype._key = function () {
|
|
3056
|
-
return this.config.authDomain
|
|
3051
|
+
return "".concat(this.config.authDomain, ":").concat(this.config.apiKey, ":").concat(this.name);
|
|
3057
3052
|
};
|
|
3058
3053
|
AuthImpl.prototype._startProactiveRefresh = function () {
|
|
3059
3054
|
this.isProactiveRefreshEnabled = true;
|
|
@@ -3098,7 +3093,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3098
3093
|
var promise = this._isInitialized
|
|
3099
3094
|
? Promise.resolve()
|
|
3100
3095
|
: this._initializationPromise;
|
|
3101
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3096
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3102
3097
|
// The callback needs to be called asynchronously per the spec.
|
|
3103
3098
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3104
3099
|
promise.then(function () { return cb(_this.currentUser); });
|
|
@@ -3148,7 +3143,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3148
3143
|
};
|
|
3149
3144
|
Object.defineProperty(AuthImpl.prototype, "assertedPersistence", {
|
|
3150
3145
|
get: function () {
|
|
3151
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3146
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3152
3147
|
return this.persistenceManager;
|
|
3153
3148
|
},
|
|
3154
3149
|
enumerable: false,
|
|
@@ -3176,10 +3171,10 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3176
3171
|
switch (_c.label) {
|
|
3177
3172
|
case 0:
|
|
3178
3173
|
headers = (_b = {},
|
|
3179
|
-
_b["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
|
|
3174
|
+
_b["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */] = this.clientVersion,
|
|
3180
3175
|
_b);
|
|
3181
3176
|
if (this.app.options.appId) {
|
|
3182
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3177
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3183
3178
|
}
|
|
3184
3179
|
return [4 /*yield*/, ((_a = this.heartbeatServiceProvider
|
|
3185
3180
|
.getImmediate({
|
|
@@ -3188,7 +3183,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3188
3183
|
case 1:
|
|
3189
3184
|
heartbeatsHeader = _c.sent();
|
|
3190
3185
|
if (heartbeatsHeader) {
|
|
3191
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3186
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3192
3187
|
}
|
|
3193
3188
|
return [2 /*return*/, headers];
|
|
3194
3189
|
}
|
|
@@ -3216,7 +3211,7 @@ var Subscription = /** @class */ (function () {
|
|
|
3216
3211
|
}
|
|
3217
3212
|
Object.defineProperty(Subscription.prototype, "next", {
|
|
3218
3213
|
get: function () {
|
|
3219
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3214
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3220
3215
|
return this.observer.next.bind(this.observer);
|
|
3221
3216
|
},
|
|
3222
3217
|
enumerable: false,
|
|
@@ -3249,14 +3244,14 @@ var Subscription = /** @class */ (function () {
|
|
|
3249
3244
|
*/
|
|
3250
3245
|
function connectAuthEmulator(auth, url, options) {
|
|
3251
3246
|
var authInternal = _castAuth(auth);
|
|
3252
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
3253
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
3247
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
3248
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
3254
3249
|
var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
3255
3250
|
var protocol = extractProtocol(url);
|
|
3256
3251
|
var _a = extractHostAndPort(url), host = _a.host, port = _a.port;
|
|
3257
|
-
var portStr = port === null ? '' : ":"
|
|
3252
|
+
var portStr = port === null ? '' : ":".concat(port);
|
|
3258
3253
|
// Always replace path with "/" (even if input url had no path at all, or had a different one).
|
|
3259
|
-
authInternal.config.emulator = { url: protocol
|
|
3254
|
+
authInternal.config.emulator = { url: "".concat(protocol, "//").concat(host).concat(portStr, "/") };
|
|
3260
3255
|
authInternal.settings.appVerificationDisabledForTesting = true;
|
|
3261
3256
|
authInternal.emulatorConfig = Object.freeze({
|
|
3262
3257
|
host: host,
|
|
@@ -3421,21 +3416,21 @@ var AuthCredential = /** @class */ (function () {
|
|
|
3421
3416
|
function resetPassword(auth, request) {
|
|
3422
3417
|
return __awaiter(this, void 0, void 0, function () {
|
|
3423
3418
|
return __generator(this, function (_a) {
|
|
3424
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3419
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3425
3420
|
});
|
|
3426
3421
|
});
|
|
3427
3422
|
}
|
|
3428
3423
|
function updateEmailPassword(auth, request) {
|
|
3429
3424
|
return __awaiter(this, void 0, void 0, function () {
|
|
3430
3425
|
return __generator(this, function (_a) {
|
|
3431
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
3426
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
3432
3427
|
});
|
|
3433
3428
|
});
|
|
3434
3429
|
}
|
|
3435
3430
|
function applyActionCode$1(auth, request) {
|
|
3436
3431
|
return __awaiter(this, void 0, void 0, function () {
|
|
3437
3432
|
return __generator(this, function (_a) {
|
|
3438
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3433
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3439
3434
|
});
|
|
3440
3435
|
});
|
|
3441
3436
|
}
|
|
@@ -3459,14 +3454,14 @@ function applyActionCode$1(auth, request) {
|
|
|
3459
3454
|
function signInWithPassword(auth, request) {
|
|
3460
3455
|
return __awaiter(this, void 0, void 0, function () {
|
|
3461
3456
|
return __generator(this, function (_a) {
|
|
3462
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3457
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3463
3458
|
});
|
|
3464
3459
|
});
|
|
3465
3460
|
}
|
|
3466
3461
|
function sendOobCode(auth, request) {
|
|
3467
3462
|
return __awaiter(this, void 0, void 0, function () {
|
|
3468
3463
|
return __generator(this, function (_a) {
|
|
3469
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3464
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3470
3465
|
});
|
|
3471
3466
|
});
|
|
3472
3467
|
}
|
|
@@ -3518,14 +3513,14 @@ function verifyAndChangeEmail(auth, request) {
|
|
|
3518
3513
|
function signInWithEmailLink$1(auth, request) {
|
|
3519
3514
|
return __awaiter(this, void 0, void 0, function () {
|
|
3520
3515
|
return __generator(this, function (_a) {
|
|
3521
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3516
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3522
3517
|
});
|
|
3523
3518
|
});
|
|
3524
3519
|
}
|
|
3525
3520
|
function signInWithEmailLinkForLinking(auth, request) {
|
|
3526
3521
|
return __awaiter(this, void 0, void 0, function () {
|
|
3527
3522
|
return __generator(this, function (_a) {
|
|
3528
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3523
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3529
3524
|
});
|
|
3530
3525
|
});
|
|
3531
3526
|
}
|
|
@@ -3567,7 +3562,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3567
3562
|
/** @internal */
|
|
3568
3563
|
_tenantId) {
|
|
3569
3564
|
if (_tenantId === void 0) { _tenantId = null; }
|
|
3570
|
-
var _this = _super.call(this, "password" /* PASSWORD */, signInMethod) || this;
|
|
3565
|
+
var _this = _super.call(this, "password" /* ProviderId.PASSWORD */, signInMethod) || this;
|
|
3571
3566
|
_this._email = _email;
|
|
3572
3567
|
_this._password = _password;
|
|
3573
3568
|
_this._tenantId = _tenantId;
|
|
@@ -3575,12 +3570,12 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3575
3570
|
}
|
|
3576
3571
|
/** @internal */
|
|
3577
3572
|
EmailAuthCredential._fromEmailAndPassword = function (email, password) {
|
|
3578
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
3573
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
3579
3574
|
};
|
|
3580
3575
|
/** @internal */
|
|
3581
3576
|
EmailAuthCredential._fromEmailAndCode = function (email, oobCode, tenantId) {
|
|
3582
3577
|
if (tenantId === void 0) { tenantId = null; }
|
|
3583
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
3578
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
3584
3579
|
};
|
|
3585
3580
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
3586
3581
|
EmailAuthCredential.prototype.toJSON = function () {
|
|
@@ -3602,10 +3597,10 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3602
3597
|
EmailAuthCredential.fromJSON = function (json) {
|
|
3603
3598
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
3604
3599
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
3605
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
3600
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
3606
3601
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
3607
3602
|
}
|
|
3608
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
3603
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
3609
3604
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
3610
3605
|
}
|
|
3611
3606
|
}
|
|
@@ -3616,19 +3611,19 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3616
3611
|
return __awaiter(this, void 0, void 0, function () {
|
|
3617
3612
|
return __generator(this, function (_a) {
|
|
3618
3613
|
switch (this.signInMethod) {
|
|
3619
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3614
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3620
3615
|
return [2 /*return*/, signInWithPassword(auth, {
|
|
3621
3616
|
returnSecureToken: true,
|
|
3622
3617
|
email: this._email,
|
|
3623
3618
|
password: this._password
|
|
3624
3619
|
})];
|
|
3625
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3620
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3626
3621
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
3627
3622
|
email: this._email,
|
|
3628
3623
|
oobCode: this._password
|
|
3629
3624
|
})];
|
|
3630
3625
|
default:
|
|
3631
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3626
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3632
3627
|
}
|
|
3633
3628
|
return [2 /*return*/];
|
|
3634
3629
|
});
|
|
@@ -3639,21 +3634,21 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3639
3634
|
return __awaiter(this, void 0, void 0, function () {
|
|
3640
3635
|
return __generator(this, function (_a) {
|
|
3641
3636
|
switch (this.signInMethod) {
|
|
3642
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3637
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3643
3638
|
return [2 /*return*/, updateEmailPassword(auth, {
|
|
3644
3639
|
idToken: idToken,
|
|
3645
3640
|
returnSecureToken: true,
|
|
3646
3641
|
email: this._email,
|
|
3647
3642
|
password: this._password
|
|
3648
3643
|
})];
|
|
3649
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3644
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3650
3645
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
3651
3646
|
idToken: idToken,
|
|
3652
3647
|
email: this._email,
|
|
3653
3648
|
oobCode: this._password
|
|
3654
3649
|
})];
|
|
3655
3650
|
default:
|
|
3656
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3651
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3657
3652
|
}
|
|
3658
3653
|
return [2 /*return*/];
|
|
3659
3654
|
});
|
|
@@ -3685,7 +3680,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3685
3680
|
function signInWithIdp(auth, request) {
|
|
3686
3681
|
return __awaiter(this, void 0, void 0, function () {
|
|
3687
3682
|
return __generator(this, function (_a) {
|
|
3688
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3683
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3689
3684
|
});
|
|
3690
3685
|
});
|
|
3691
3686
|
}
|
|
@@ -3747,7 +3742,7 @@ var OAuthCredential = /** @class */ (function (_super) {
|
|
|
3747
3742
|
cred.secret = params.oauthTokenSecret;
|
|
3748
3743
|
}
|
|
3749
3744
|
else {
|
|
3750
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
3745
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3751
3746
|
}
|
|
3752
3747
|
return cred;
|
|
3753
3748
|
};
|
|
@@ -3853,14 +3848,14 @@ var _a;
|
|
|
3853
3848
|
function sendPhoneVerificationCode(auth, request) {
|
|
3854
3849
|
return __awaiter(this, void 0, void 0, function () {
|
|
3855
3850
|
return __generator(this, function (_a) {
|
|
3856
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendVerificationCode" /* SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
3851
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendVerificationCode" /* Endpoint.SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
3857
3852
|
});
|
|
3858
3853
|
});
|
|
3859
3854
|
}
|
|
3860
3855
|
function signInWithPhoneNumber$1(auth, request) {
|
|
3861
3856
|
return __awaiter(this, void 0, void 0, function () {
|
|
3862
3857
|
return __generator(this, function (_a) {
|
|
3863
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3858
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3864
3859
|
});
|
|
3865
3860
|
});
|
|
3866
3861
|
}
|
|
@@ -3869,11 +3864,11 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3869
3864
|
var response;
|
|
3870
3865
|
return __generator(this, function (_a) {
|
|
3871
3866
|
switch (_a.label) {
|
|
3872
|
-
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3867
|
+
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3873
3868
|
case 1:
|
|
3874
3869
|
response = _a.sent();
|
|
3875
3870
|
if (response.temporaryProof) {
|
|
3876
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
3871
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
3877
3872
|
}
|
|
3878
3873
|
return [2 /*return*/, response];
|
|
3879
3874
|
}
|
|
@@ -3881,14 +3876,14 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3881
3876
|
});
|
|
3882
3877
|
}
|
|
3883
3878
|
var VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = (_a = {},
|
|
3884
|
-
_a["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
3879
|
+
_a["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
3885
3880
|
_a);
|
|
3886
3881
|
function verifyPhoneNumberForExisting(auth, request) {
|
|
3887
3882
|
return __awaiter(this, void 0, void 0, function () {
|
|
3888
3883
|
var apiRequest;
|
|
3889
3884
|
return __generator(this, function (_a) {
|
|
3890
3885
|
apiRequest = __assign(__assign({}, request), { operation: 'REAUTH' });
|
|
3891
|
-
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_)];
|
|
3886
|
+
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_)];
|
|
3892
3887
|
});
|
|
3893
3888
|
});
|
|
3894
3889
|
}
|
|
@@ -3917,7 +3912,7 @@ function verifyPhoneNumberForExisting(auth, request) {
|
|
|
3917
3912
|
var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
3918
3913
|
__extends(PhoneAuthCredential, _super);
|
|
3919
3914
|
function PhoneAuthCredential(params) {
|
|
3920
|
-
var _this = _super.call(this, "phone" /* PHONE */, "phone" /* PHONE */) || this;
|
|
3915
|
+
var _this = _super.call(this, "phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */) || this;
|
|
3921
3916
|
_this.params = params;
|
|
3922
3917
|
return _this;
|
|
3923
3918
|
}
|
|
@@ -4017,17 +4012,17 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
|
4017
4012
|
function parseMode(mode) {
|
|
4018
4013
|
switch (mode) {
|
|
4019
4014
|
case 'recoverEmail':
|
|
4020
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
4015
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
4021
4016
|
case 'resetPassword':
|
|
4022
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
4017
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
4023
4018
|
case 'signIn':
|
|
4024
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
4019
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
4025
4020
|
case 'verifyEmail':
|
|
4026
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
4021
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
4027
4022
|
case 'verifyAndChangeEmail':
|
|
4028
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
4023
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
4029
4024
|
case 'revertSecondFactorAddition':
|
|
4030
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
4025
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
4031
4026
|
default:
|
|
4032
4027
|
return null;
|
|
4033
4028
|
}
|
|
@@ -4066,17 +4061,17 @@ var ActionCodeURL = /** @class */ (function () {
|
|
|
4066
4061
|
function ActionCodeURL(actionLink) {
|
|
4067
4062
|
var _a, _b, _c, _d, _e, _f;
|
|
4068
4063
|
var searchParams = querystringDecode(extractQuerystring(actionLink));
|
|
4069
|
-
var apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4070
|
-
var code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4071
|
-
var operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4064
|
+
var apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4065
|
+
var code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4066
|
+
var operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4072
4067
|
// Validate API key, code and mode.
|
|
4073
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
4068
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4074
4069
|
this.apiKey = apiKey;
|
|
4075
4070
|
this.operation = operation;
|
|
4076
4071
|
this.code = code;
|
|
4077
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4078
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4079
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4072
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4073
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4074
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4080
4075
|
}
|
|
4081
4076
|
/**
|
|
4082
4077
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -4181,21 +4176,21 @@ var EmailAuthProvider = /** @class */ (function () {
|
|
|
4181
4176
|
*/
|
|
4182
4177
|
EmailAuthProvider.credentialWithLink = function (email, emailLink) {
|
|
4183
4178
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
4184
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
4179
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4185
4180
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
4186
4181
|
};
|
|
4187
4182
|
/**
|
|
4188
4183
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
4189
4184
|
*/
|
|
4190
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
4185
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
4191
4186
|
/**
|
|
4192
4187
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
4193
4188
|
*/
|
|
4194
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
4189
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
4195
4190
|
/**
|
|
4196
4191
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
4197
4192
|
*/
|
|
4198
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
4193
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
4199
4194
|
return EmailAuthProvider;
|
|
4200
4195
|
}());
|
|
4201
4196
|
|
|
@@ -4312,7 +4307,7 @@ var BaseOAuthProvider = /** @class */ (function (_super) {
|
|
|
4312
4307
|
* Retrieve the current list of OAuth scopes.
|
|
4313
4308
|
*/
|
|
4314
4309
|
BaseOAuthProvider.prototype.getScopes = function () {
|
|
4315
|
-
return __spreadArray([], this.scopes);
|
|
4310
|
+
return __spreadArray([], this.scopes, true);
|
|
4316
4311
|
};
|
|
4317
4312
|
return BaseOAuthProvider;
|
|
4318
4313
|
}(FederatedAuthProvider));
|
|
@@ -4367,7 +4362,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4367
4362
|
*/
|
|
4368
4363
|
OAuthProvider.credentialFromJSON = function (json) {
|
|
4369
4364
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
4370
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
4365
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4371
4366
|
return OAuthCredential._fromParams(obj);
|
|
4372
4367
|
};
|
|
4373
4368
|
/**
|
|
@@ -4396,7 +4391,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4396
4391
|
};
|
|
4397
4392
|
/** An internal credential method that accepts more permissive options */
|
|
4398
4393
|
OAuthProvider.prototype._credential = function (params) {
|
|
4399
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
4394
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4400
4395
|
// For OAuthCredential, sign in method is same as providerId.
|
|
4401
4396
|
return OAuthCredential._fromParams(__assign(__assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
4402
4397
|
};
|
|
@@ -4505,7 +4500,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4505
4500
|
var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
4506
4501
|
__extends(FacebookAuthProvider, _super);
|
|
4507
4502
|
function FacebookAuthProvider() {
|
|
4508
|
-
return _super.call(this, "facebook.com" /* FACEBOOK */) || this;
|
|
4503
|
+
return _super.call(this, "facebook.com" /* ProviderId.FACEBOOK */) || this;
|
|
4509
4504
|
}
|
|
4510
4505
|
/**
|
|
4511
4506
|
* Creates a credential for Facebook.
|
|
@@ -4559,9 +4554,9 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4559
4554
|
}
|
|
4560
4555
|
};
|
|
4561
4556
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
4562
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
4557
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
4563
4558
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
4564
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
4559
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
4565
4560
|
return FacebookAuthProvider;
|
|
4566
4561
|
}(BaseOAuthProvider));
|
|
4567
4562
|
|
|
@@ -4625,7 +4620,7 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4625
4620
|
var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
4626
4621
|
__extends(GoogleAuthProvider, _super);
|
|
4627
4622
|
function GoogleAuthProvider() {
|
|
4628
|
-
var _this = _super.call(this, "google.com" /* GOOGLE */) || this;
|
|
4623
|
+
var _this = _super.call(this, "google.com" /* ProviderId.GOOGLE */) || this;
|
|
4629
4624
|
_this.addScope('profile');
|
|
4630
4625
|
return _this;
|
|
4631
4626
|
}
|
|
@@ -4685,9 +4680,9 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4685
4680
|
}
|
|
4686
4681
|
};
|
|
4687
4682
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
4688
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
4683
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
4689
4684
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
4690
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
4685
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
4691
4686
|
return GoogleAuthProvider;
|
|
4692
4687
|
}(BaseOAuthProvider));
|
|
4693
4688
|
|
|
@@ -4752,7 +4747,7 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4752
4747
|
var GithubAuthProvider = /** @class */ (function (_super) {
|
|
4753
4748
|
__extends(GithubAuthProvider, _super);
|
|
4754
4749
|
function GithubAuthProvider() {
|
|
4755
|
-
return _super.call(this, "github.com" /* GITHUB */) || this;
|
|
4750
|
+
return _super.call(this, "github.com" /* ProviderId.GITHUB */) || this;
|
|
4756
4751
|
}
|
|
4757
4752
|
/**
|
|
4758
4753
|
* Creates a credential for Github.
|
|
@@ -4799,9 +4794,9 @@ var GithubAuthProvider = /** @class */ (function (_super) {
|
|
|
4799
4794
|
}
|
|
4800
4795
|
};
|
|
4801
4796
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
4802
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
4797
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
4803
4798
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
4804
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
4799
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
4805
4800
|
return GithubAuthProvider;
|
|
4806
4801
|
}(BaseOAuthProvider));
|
|
4807
4802
|
|
|
@@ -4925,10 +4920,8 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4925
4920
|
* @param providerId - SAML provider ID.
|
|
4926
4921
|
*/
|
|
4927
4922
|
function SAMLAuthProvider(providerId) {
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
_this = _super.call(this, providerId) || this;
|
|
4931
|
-
return _this;
|
|
4923
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4924
|
+
return _super.call(this, providerId) || this;
|
|
4932
4925
|
}
|
|
4933
4926
|
/**
|
|
4934
4927
|
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
|
|
@@ -4964,7 +4957,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4964
4957
|
*/
|
|
4965
4958
|
SAMLAuthProvider.credentialFromJSON = function (json) {
|
|
4966
4959
|
var credential = SAMLAuthCredential.fromJSON(json);
|
|
4967
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
4960
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4968
4961
|
return credential;
|
|
4969
4962
|
};
|
|
4970
4963
|
SAMLAuthProvider.samlCredentialFromTaggedObject = function (_a) {
|
|
@@ -5044,7 +5037,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5044
5037
|
var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
5045
5038
|
__extends(TwitterAuthProvider, _super);
|
|
5046
5039
|
function TwitterAuthProvider() {
|
|
5047
|
-
return _super.call(this, "twitter.com" /* TWITTER */) || this;
|
|
5040
|
+
return _super.call(this, "twitter.com" /* ProviderId.TWITTER */) || this;
|
|
5048
5041
|
}
|
|
5049
5042
|
/**
|
|
5050
5043
|
* Creates a credential for Twitter.
|
|
@@ -5094,9 +5087,9 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5094
5087
|
}
|
|
5095
5088
|
};
|
|
5096
5089
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
5097
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
5090
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
5098
5091
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
5099
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
5092
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
5100
5093
|
return TwitterAuthProvider;
|
|
5101
5094
|
}(BaseOAuthProvider));
|
|
5102
5095
|
|
|
@@ -5119,7 +5112,7 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5119
5112
|
function signUp(auth, request) {
|
|
5120
5113
|
return __awaiter(this, void 0, void 0, function () {
|
|
5121
5114
|
return __generator(this, function (_a) {
|
|
5122
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5115
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5123
5116
|
});
|
|
5124
5117
|
});
|
|
5125
5118
|
}
|
|
@@ -5194,7 +5187,7 @@ function providerIdForResponse(response) {
|
|
|
5194
5187
|
return response.providerId;
|
|
5195
5188
|
}
|
|
5196
5189
|
if ('phoneNumber' in response) {
|
|
5197
|
-
return "phone" /* PHONE */;
|
|
5190
|
+
return "phone" /* ProviderId.PHONE */;
|
|
5198
5191
|
}
|
|
5199
5192
|
return null;
|
|
5200
5193
|
}
|
|
@@ -5242,7 +5235,7 @@ function signInAnonymously(auth) {
|
|
|
5242
5235
|
return [2 /*return*/, new UserCredentialImpl({
|
|
5243
5236
|
user: authInternal.currentUser,
|
|
5244
5237
|
providerId: null,
|
|
5245
|
-
operationType: "signIn" /* SIGN_IN */
|
|
5238
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
5246
5239
|
})];
|
|
5247
5240
|
}
|
|
5248
5241
|
return [4 /*yield*/, signUp(authInternal, {
|
|
@@ -5250,7 +5243,7 @@ function signInAnonymously(auth) {
|
|
|
5250
5243
|
})];
|
|
5251
5244
|
case 2:
|
|
5252
5245
|
response = _b.sent();
|
|
5253
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true)];
|
|
5246
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true)];
|
|
5254
5247
|
case 3:
|
|
5255
5248
|
userCredential = _b.sent();
|
|
5256
5249
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -5281,8 +5274,9 @@ function signInAnonymously(auth) {
|
|
|
5281
5274
|
var MultiFactorError = /** @class */ (function (_super) {
|
|
5282
5275
|
__extends(MultiFactorError, _super);
|
|
5283
5276
|
function MultiFactorError(auth, error, operationType, user) {
|
|
5277
|
+
var _this = this;
|
|
5284
5278
|
var _a;
|
|
5285
|
-
|
|
5279
|
+
_this = _super.call(this, error.code, error.message) || this;
|
|
5286
5280
|
_this.operationType = operationType;
|
|
5287
5281
|
_this.user = user;
|
|
5288
5282
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -5301,11 +5295,11 @@ var MultiFactorError = /** @class */ (function (_super) {
|
|
|
5301
5295
|
return MultiFactorError;
|
|
5302
5296
|
}(FirebaseError));
|
|
5303
5297
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
5304
|
-
var idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
5298
|
+
var idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
5305
5299
|
? credential._getReauthenticationResolver(auth)
|
|
5306
5300
|
: credential._getIdTokenResponse(auth);
|
|
5307
5301
|
return idTokenProvider.catch(function (error) {
|
|
5308
|
-
if (error.code === "auth/"
|
|
5302
|
+
if (error.code === "auth/".concat("multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */)) {
|
|
5309
5303
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
5310
5304
|
}
|
|
5311
5305
|
throw error;
|
|
@@ -5388,7 +5382,7 @@ function unlink(user, providerId) {
|
|
|
5388
5382
|
userInternal.providerData = userInternal.providerData.filter(function (pd) {
|
|
5389
5383
|
return providersLeft.has(pd.providerId);
|
|
5390
5384
|
});
|
|
5391
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
5385
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
5392
5386
|
userInternal.phoneNumber = null;
|
|
5393
5387
|
}
|
|
5394
5388
|
return [4 /*yield*/, userInternal.auth._persistUserIfCurrent(userInternal)];
|
|
@@ -5411,10 +5405,11 @@ function _link$1(user, credential, bypassAuthState) {
|
|
|
5411
5405
|
_d = (_c = credential)._linkToIdToken;
|
|
5412
5406
|
_e = [user.auth];
|
|
5413
5407
|
return [4 /*yield*/, user.getIdToken()];
|
|
5414
|
-
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5408
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5409
|
+
bypassAuthState]))];
|
|
5415
5410
|
case 2:
|
|
5416
5411
|
response = _f.sent();
|
|
5417
|
-
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* LINK */, response)];
|
|
5412
|
+
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response)];
|
|
5418
5413
|
}
|
|
5419
5414
|
});
|
|
5420
5415
|
});
|
|
@@ -5429,8 +5424,8 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5429
5424
|
_a.sent();
|
|
5430
5425
|
providerIds = providerDataAsNames(user.providerData);
|
|
5431
5426
|
code = expected === false
|
|
5432
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
5433
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
5427
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
5428
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
5434
5429
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
5435
5430
|
return [2 /*return*/];
|
|
5436
5431
|
}
|
|
@@ -5455,32 +5450,31 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5455
5450
|
* limitations under the License.
|
|
5456
5451
|
*/
|
|
5457
5452
|
function _reauthenticate(user, credential, bypassAuthState) {
|
|
5458
|
-
var _a;
|
|
5459
5453
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
5460
5454
|
return __awaiter(this, void 0, void 0, function () {
|
|
5461
5455
|
var auth, operationType, response, parsed, localId, e_1;
|
|
5462
|
-
return __generator(this, function (
|
|
5463
|
-
switch (
|
|
5456
|
+
return __generator(this, function (_a) {
|
|
5457
|
+
switch (_a.label) {
|
|
5464
5458
|
case 0:
|
|
5465
5459
|
auth = user.auth;
|
|
5466
|
-
operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
5467
|
-
|
|
5460
|
+
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
5461
|
+
_a.label = 1;
|
|
5468
5462
|
case 1:
|
|
5469
|
-
|
|
5463
|
+
_a.trys.push([1, 3, , 4]);
|
|
5470
5464
|
return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
|
|
5471
5465
|
case 2:
|
|
5472
|
-
response =
|
|
5473
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5466
|
+
response = _a.sent();
|
|
5467
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5474
5468
|
parsed = _parseToken(response.idToken);
|
|
5475
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5469
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5476
5470
|
localId = parsed.sub;
|
|
5477
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5471
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5478
5472
|
return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
|
|
5479
5473
|
case 3:
|
|
5480
|
-
e_1 =
|
|
5474
|
+
e_1 = _a.sent();
|
|
5481
5475
|
// Convert user deleted error into user mismatch
|
|
5482
|
-
if ((
|
|
5483
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5476
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/".concat("user-not-found" /* AuthErrorCode.USER_DELETED */)) {
|
|
5477
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5484
5478
|
}
|
|
5485
5479
|
throw e_1;
|
|
5486
5480
|
case 4: return [2 /*return*/];
|
|
@@ -5512,7 +5506,7 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
5512
5506
|
return __generator(this, function (_a) {
|
|
5513
5507
|
switch (_a.label) {
|
|
5514
5508
|
case 0:
|
|
5515
|
-
operationType = "signIn" /* SIGN_IN */;
|
|
5509
|
+
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
5516
5510
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
5517
5511
|
case 1:
|
|
5518
5512
|
response = _a.sent();
|
|
@@ -5612,7 +5606,7 @@ function reauthenticateWithCredential(user, credential) {
|
|
|
5612
5606
|
function signInWithCustomToken$1(auth, request) {
|
|
5613
5607
|
return __awaiter(this, void 0, void 0, function () {
|
|
5614
5608
|
return __generator(this, function (_a) {
|
|
5615
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5609
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5616
5610
|
});
|
|
5617
5611
|
});
|
|
5618
5612
|
}
|
|
@@ -5662,7 +5656,7 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
5662
5656
|
})];
|
|
5663
5657
|
case 1:
|
|
5664
5658
|
response = _a.sent();
|
|
5665
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5659
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5666
5660
|
case 2:
|
|
5667
5661
|
cred = _a.sent();
|
|
5668
5662
|
return [4 /*yield*/, authInternal._updateCurrentUser(cred.user)];
|
|
@@ -5701,14 +5695,14 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
5701
5695
|
if ('phoneInfo' in enrollment) {
|
|
5702
5696
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
5703
5697
|
}
|
|
5704
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5698
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5705
5699
|
};
|
|
5706
5700
|
return MultiFactorInfoImpl;
|
|
5707
5701
|
}());
|
|
5708
5702
|
var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
5709
5703
|
__extends(PhoneMultiFactorInfoImpl, _super);
|
|
5710
5704
|
function PhoneMultiFactorInfoImpl(response) {
|
|
5711
|
-
var _this = _super.call(this, "phone" /* PHONE */, response) || this;
|
|
5705
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */, response) || this;
|
|
5712
5706
|
_this.phoneNumber = response.phoneInfo;
|
|
5713
5707
|
return _this;
|
|
5714
5708
|
}
|
|
@@ -5736,18 +5730,18 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
5736
5730
|
*/
|
|
5737
5731
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
5738
5732
|
var _a;
|
|
5739
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
5733
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
5740
5734
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
5741
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5735
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5742
5736
|
request.continueUrl = actionCodeSettings.url;
|
|
5743
5737
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
5744
5738
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
5745
5739
|
if (actionCodeSettings.iOS) {
|
|
5746
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
5740
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
5747
5741
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
5748
5742
|
}
|
|
5749
5743
|
if (actionCodeSettings.android) {
|
|
5750
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
5744
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
5751
5745
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
5752
5746
|
request.androidMinimumVersionCode =
|
|
5753
5747
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -5811,7 +5805,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
5811
5805
|
case 0:
|
|
5812
5806
|
authModular = getModularInstance(auth);
|
|
5813
5807
|
request = {
|
|
5814
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
5808
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5815
5809
|
email: email
|
|
5816
5810
|
};
|
|
5817
5811
|
if (actionCodeSettings) {
|
|
@@ -5890,18 +5884,18 @@ function checkActionCode(auth, oobCode) {
|
|
|
5890
5884
|
case 1:
|
|
5891
5885
|
response = _a.sent();
|
|
5892
5886
|
operation = response.requestType;
|
|
5893
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5887
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5894
5888
|
switch (operation) {
|
|
5895
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
5889
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
5896
5890
|
break;
|
|
5897
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
5898
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5891
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
5892
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5899
5893
|
break;
|
|
5900
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
5901
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5894
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
5895
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5902
5896
|
// fall through
|
|
5903
5897
|
default:
|
|
5904
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5898
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5905
5899
|
}
|
|
5906
5900
|
multiFactorInfo = null;
|
|
5907
5901
|
if (response.mfaInfo) {
|
|
@@ -5909,10 +5903,10 @@ function checkActionCode(auth, oobCode) {
|
|
|
5909
5903
|
}
|
|
5910
5904
|
return [2 /*return*/, {
|
|
5911
5905
|
data: {
|
|
5912
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5906
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5913
5907
|
? response.newEmail
|
|
5914
5908
|
: response.email) || null,
|
|
5915
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5909
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5916
5910
|
? response.email
|
|
5917
5911
|
: response.newEmail) || null,
|
|
5918
5912
|
multiFactorInfo: multiFactorInfo
|
|
@@ -5978,7 +5972,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5978
5972
|
})];
|
|
5979
5973
|
case 1:
|
|
5980
5974
|
response = _a.sent();
|
|
5981
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5975
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5982
5976
|
case 2:
|
|
5983
5977
|
userCredential = _a.sent();
|
|
5984
5978
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -6071,10 +6065,10 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6071
6065
|
case 0:
|
|
6072
6066
|
authModular = getModularInstance(auth);
|
|
6073
6067
|
request = {
|
|
6074
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
6068
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
6075
6069
|
email: email
|
|
6076
6070
|
};
|
|
6077
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6071
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6078
6072
|
if (actionCodeSettings) {
|
|
6079
6073
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
6080
6074
|
}
|
|
@@ -6096,7 +6090,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6096
6090
|
*/
|
|
6097
6091
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
6098
6092
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
6099
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
6093
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
6100
6094
|
}
|
|
6101
6095
|
/**
|
|
6102
6096
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -6143,7 +6137,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6143
6137
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
6144
6138
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
6145
6139
|
// instance.
|
|
6146
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
6140
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
6147
6141
|
return [2 /*return*/, signInWithCredential(authModular, credential)];
|
|
6148
6142
|
});
|
|
6149
6143
|
});
|
|
@@ -6168,7 +6162,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6168
6162
|
function createAuthUri(auth, request) {
|
|
6169
6163
|
return __awaiter(this, void 0, void 0, function () {
|
|
6170
6164
|
return __generator(this, function (_a) {
|
|
6171
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6165
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6172
6166
|
});
|
|
6173
6167
|
});
|
|
6174
6168
|
}
|
|
@@ -6263,7 +6257,7 @@ function sendEmailVerification(user, actionCodeSettings) {
|
|
|
6263
6257
|
case 1:
|
|
6264
6258
|
idToken = _a.sent();
|
|
6265
6259
|
request = {
|
|
6266
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
6260
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
6267
6261
|
idToken: idToken
|
|
6268
6262
|
};
|
|
6269
6263
|
if (actionCodeSettings) {
|
|
@@ -6327,7 +6321,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6327
6321
|
case 1:
|
|
6328
6322
|
idToken = _a.sent();
|
|
6329
6323
|
request = {
|
|
6330
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
6324
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
6331
6325
|
idToken: idToken,
|
|
6332
6326
|
newEmail: newEmail
|
|
6333
6327
|
};
|
|
@@ -6371,7 +6365,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6371
6365
|
function updateProfile$1(auth, request) {
|
|
6372
6366
|
return __awaiter(this, void 0, void 0, function () {
|
|
6373
6367
|
return __generator(this, function (_a) {
|
|
6374
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
6368
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
6375
6369
|
});
|
|
6376
6370
|
});
|
|
6377
6371
|
}
|
|
@@ -6427,7 +6421,7 @@ function updateProfile(user, _a) {
|
|
|
6427
6421
|
userInternal.photoURL = response.photoUrl || null;
|
|
6428
6422
|
passwordProvider = userInternal.providerData.find(function (_a) {
|
|
6429
6423
|
var providerId = _a.providerId;
|
|
6430
|
-
return providerId === "password" /* PASSWORD */;
|
|
6424
|
+
return providerId === "password" /* ProviderId.PASSWORD */;
|
|
6431
6425
|
});
|
|
6432
6426
|
if (passwordProvider) {
|
|
6433
6427
|
passwordProvider.displayName = userInternal.displayName;
|
|
@@ -6538,12 +6532,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6538
6532
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
6539
6533
|
: {};
|
|
6540
6534
|
var isNewUser = idTokenResponse.isNewUser ||
|
|
6541
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
6535
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
6542
6536
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
6543
6537
|
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'];
|
|
6544
6538
|
if (signInProvider) {
|
|
6545
|
-
var filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
6546
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
6539
|
+
var filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
6540
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
6547
6541
|
? signInProvider
|
|
6548
6542
|
: null;
|
|
6549
6543
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -6554,16 +6548,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6554
6548
|
return null;
|
|
6555
6549
|
}
|
|
6556
6550
|
switch (providerId) {
|
|
6557
|
-
case "facebook.com" /* FACEBOOK */:
|
|
6551
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
6558
6552
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
6559
|
-
case "github.com" /* GITHUB */:
|
|
6553
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
6560
6554
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
6561
|
-
case "google.com" /* GOOGLE */:
|
|
6555
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
6562
6556
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
6563
|
-
case "twitter.com" /* TWITTER */:
|
|
6557
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
6564
6558
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
6565
|
-
case "custom" /* CUSTOM */:
|
|
6566
|
-
case "anonymous" /* ANONYMOUS */:
|
|
6559
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
6560
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
6567
6561
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
6568
6562
|
default:
|
|
6569
6563
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -6590,28 +6584,28 @@ var FederatedAdditionalUserInfoWithUsername = /** @class */ (function (_super) {
|
|
|
6590
6584
|
var FacebookAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6591
6585
|
__extends(FacebookAdditionalUserInfo, _super);
|
|
6592
6586
|
function FacebookAdditionalUserInfo(isNewUser, profile) {
|
|
6593
|
-
return _super.call(this, isNewUser, "facebook.com" /* FACEBOOK */, profile) || this;
|
|
6587
|
+
return _super.call(this, isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile) || this;
|
|
6594
6588
|
}
|
|
6595
6589
|
return FacebookAdditionalUserInfo;
|
|
6596
6590
|
}(GenericAdditionalUserInfo));
|
|
6597
6591
|
var GithubAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6598
6592
|
__extends(GithubAdditionalUserInfo, _super);
|
|
6599
6593
|
function GithubAdditionalUserInfo(isNewUser, profile) {
|
|
6600
|
-
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;
|
|
6594
|
+
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;
|
|
6601
6595
|
}
|
|
6602
6596
|
return GithubAdditionalUserInfo;
|
|
6603
6597
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
6604
6598
|
var GoogleAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6605
6599
|
__extends(GoogleAdditionalUserInfo, _super);
|
|
6606
6600
|
function GoogleAdditionalUserInfo(isNewUser, profile) {
|
|
6607
|
-
return _super.call(this, isNewUser, "google.com" /* GOOGLE */, profile) || this;
|
|
6601
|
+
return _super.call(this, isNewUser, "google.com" /* ProviderId.GOOGLE */, profile) || this;
|
|
6608
6602
|
}
|
|
6609
6603
|
return GoogleAdditionalUserInfo;
|
|
6610
6604
|
}(GenericAdditionalUserInfo));
|
|
6611
6605
|
var TwitterAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6612
6606
|
__extends(TwitterAdditionalUserInfo, _super);
|
|
6613
6607
|
function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {
|
|
6614
|
-
return _super.call(this, isNewUser, "twitter.com" /* TWITTER */, profile, screenName) || this;
|
|
6608
|
+
return _super.call(this, isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName) || this;
|
|
6615
6609
|
}
|
|
6616
6610
|
return TwitterAdditionalUserInfo;
|
|
6617
6611
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
@@ -6794,14 +6788,14 @@ var MultiFactorSessionImpl = /** @class */ (function () {
|
|
|
6794
6788
|
this.auth = auth;
|
|
6795
6789
|
}
|
|
6796
6790
|
MultiFactorSessionImpl._fromIdtoken = function (idToken, auth) {
|
|
6797
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
6791
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
6798
6792
|
};
|
|
6799
6793
|
MultiFactorSessionImpl._fromMfaPendingCredential = function (mfaPendingCredential) {
|
|
6800
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
6794
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
6801
6795
|
};
|
|
6802
6796
|
MultiFactorSessionImpl.prototype.toJSON = function () {
|
|
6803
6797
|
var _a;
|
|
6804
|
-
var key = this.type === "enroll" /* ENROLL */
|
|
6798
|
+
var key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
6805
6799
|
? 'idToken'
|
|
6806
6800
|
: 'pendingCredential';
|
|
6807
6801
|
return {
|
|
@@ -6855,7 +6849,7 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6855
6849
|
var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
|
|
6856
6850
|
return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
6857
6851
|
});
|
|
6858
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6852
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6859
6853
|
var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
6860
6854
|
return new MultiFactorResolverImpl(session, hints, function (assertion) { return __awaiter(_this, void 0, void 0, function () {
|
|
6861
6855
|
var mfaResponse, idTokenResponse, _a, userCredential;
|
|
@@ -6870,8 +6864,8 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6870
6864
|
idTokenResponse = __assign(__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
6871
6865
|
_a = error.operationType;
|
|
6872
6866
|
switch (_a) {
|
|
6873
|
-
case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
|
|
6874
|
-
case "reauthenticate" /* REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6867
|
+
case "signIn" /* OperationType.SIGN_IN */: return [3 /*break*/, 2];
|
|
6868
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6875
6869
|
}
|
|
6876
6870
|
return [3 /*break*/, 6];
|
|
6877
6871
|
case 2: return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse)];
|
|
@@ -6882,10 +6876,10 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6882
6876
|
_b.sent();
|
|
6883
6877
|
return [2 /*return*/, userCredential];
|
|
6884
6878
|
case 5:
|
|
6885
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6879
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6886
6880
|
return [2 /*return*/, UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse)];
|
|
6887
6881
|
case 6:
|
|
6888
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6882
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6889
6883
|
_b.label = 7;
|
|
6890
6884
|
case 7: return [2 /*return*/];
|
|
6891
6885
|
}
|
|
@@ -6917,8 +6911,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6917
6911
|
var _a;
|
|
6918
6912
|
var authModular = getModularInstance(auth);
|
|
6919
6913
|
var errorInternal = error;
|
|
6920
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6921
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6914
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6915
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6922
6916
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
6923
6917
|
}
|
|
6924
6918
|
|
|
@@ -6939,13 +6933,13 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6939
6933
|
* limitations under the License.
|
|
6940
6934
|
*/
|
|
6941
6935
|
function startEnrollPhoneMfa(auth, request) {
|
|
6942
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:start" /* START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6936
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6943
6937
|
}
|
|
6944
6938
|
function finalizeEnrollPhoneMfa(auth, request) {
|
|
6945
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:finalize" /* FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6939
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6946
6940
|
}
|
|
6947
6941
|
function withdrawMfa(auth, request) {
|
|
6948
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6942
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6949
6943
|
}
|
|
6950
6944
|
|
|
6951
6945
|
var MultiFactorUserImpl = /** @class */ (function () {
|
|
@@ -7006,22 +7000,21 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7006
7000
|
});
|
|
7007
7001
|
};
|
|
7008
7002
|
MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
|
|
7009
|
-
var _a;
|
|
7010
7003
|
return __awaiter(this, void 0, void 0, function () {
|
|
7011
7004
|
var mfaEnrollmentId, idToken, idTokenResponse, e_1;
|
|
7012
|
-
return __generator(this, function (
|
|
7013
|
-
switch (
|
|
7005
|
+
return __generator(this, function (_a) {
|
|
7006
|
+
switch (_a.label) {
|
|
7014
7007
|
case 0:
|
|
7015
7008
|
mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
7016
7009
|
return [4 /*yield*/, this.user.getIdToken()];
|
|
7017
7010
|
case 1:
|
|
7018
|
-
idToken =
|
|
7011
|
+
idToken = _a.sent();
|
|
7019
7012
|
return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
7020
7013
|
idToken: idToken,
|
|
7021
7014
|
mfaEnrollmentId: mfaEnrollmentId
|
|
7022
7015
|
}))];
|
|
7023
7016
|
case 2:
|
|
7024
|
-
idTokenResponse =
|
|
7017
|
+
idTokenResponse = _a.sent();
|
|
7025
7018
|
// Remove the second factor from the user's list.
|
|
7026
7019
|
this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
|
|
7027
7020
|
var uid = _a.uid;
|
|
@@ -7037,17 +7030,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7037
7030
|
// the tokenResponse may be empty. If the tokens were not updated (and they
|
|
7038
7031
|
// are now invalid), reloading the user will discover this and invalidate
|
|
7039
7032
|
// the user's state accordingly.
|
|
7040
|
-
|
|
7041
|
-
|
|
7033
|
+
_a.sent();
|
|
7034
|
+
_a.label = 4;
|
|
7042
7035
|
case 4:
|
|
7043
|
-
|
|
7036
|
+
_a.trys.push([4, 6, , 7]);
|
|
7044
7037
|
return [4 /*yield*/, this.user.reload()];
|
|
7045
7038
|
case 5:
|
|
7046
|
-
|
|
7039
|
+
_a.sent();
|
|
7047
7040
|
return [3 /*break*/, 7];
|
|
7048
7041
|
case 6:
|
|
7049
|
-
e_1 =
|
|
7050
|
-
if ((
|
|
7042
|
+
e_1 = _a.sent();
|
|
7043
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
|
|
7051
7044
|
throw e_1;
|
|
7052
7045
|
}
|
|
7053
7046
|
return [3 /*break*/, 7];
|
|
@@ -7165,7 +7158,7 @@ var IE10_LOCAL_STORAGE_SYNC_DELAY = 10;
|
|
|
7165
7158
|
var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
7166
7159
|
__extends(BrowserLocalPersistence, _super);
|
|
7167
7160
|
function BrowserLocalPersistence() {
|
|
7168
|
-
var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* LOCAL */) || this;
|
|
7161
|
+
var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* PersistenceType.LOCAL */) || this;
|
|
7169
7162
|
_this.boundEventHandler = function (event, poll) { return _this.onStorageEvent(event, poll); };
|
|
7170
7163
|
_this.listeners = {};
|
|
7171
7164
|
_this.localCache = {};
|
|
@@ -7401,7 +7394,7 @@ var browserLocalPersistence = BrowserLocalPersistence;
|
|
|
7401
7394
|
var BrowserSessionPersistence = /** @class */ (function (_super) {
|
|
7402
7395
|
__extends(BrowserSessionPersistence, _super);
|
|
7403
7396
|
function BrowserSessionPersistence() {
|
|
7404
|
-
return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* SESSION */) || this;
|
|
7397
|
+
return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* PersistenceType.SESSION */) || this;
|
|
7405
7398
|
}
|
|
7406
7399
|
BrowserSessionPersistence.prototype._addListener = function (_key, _listener) {
|
|
7407
7400
|
// Listeners are not supported for session storage since it cannot be shared across windows
|
|
@@ -7543,7 +7536,7 @@ var Receiver = /** @class */ (function () {
|
|
|
7543
7536
|
return [2 /*return*/];
|
|
7544
7537
|
}
|
|
7545
7538
|
messageEvent.ports[0].postMessage({
|
|
7546
|
-
status: "ack" /* ACK */,
|
|
7539
|
+
status: "ack" /* _Status.ACK */,
|
|
7547
7540
|
eventId: eventId,
|
|
7548
7541
|
eventType: eventType
|
|
7549
7542
|
});
|
|
@@ -7554,7 +7547,7 @@ var Receiver = /** @class */ (function () {
|
|
|
7554
7547
|
case 1:
|
|
7555
7548
|
response = _b.sent();
|
|
7556
7549
|
messageEvent.ports[0].postMessage({
|
|
7557
|
-
status: "done" /* DONE */,
|
|
7550
|
+
status: "done" /* _Status.DONE */,
|
|
7558
7551
|
eventId: eventId,
|
|
7559
7552
|
eventType: eventType,
|
|
7560
7553
|
response: response
|
|
@@ -7679,20 +7672,20 @@ var Sender = /** @class */ (function () {
|
|
|
7679
7672
|
* @returns An array of settled promises from all the handlers that were listening on the receiver.
|
|
7680
7673
|
*/
|
|
7681
7674
|
Sender.prototype._send = function (eventType, data, timeout) {
|
|
7682
|
-
if (timeout === void 0) { timeout = 50 /* ACK */; }
|
|
7675
|
+
if (timeout === void 0) { timeout = 50 /* _TimeoutDuration.ACK */; }
|
|
7683
7676
|
return __awaiter(this, void 0, void 0, function () {
|
|
7684
7677
|
var messageChannel, completionTimer, handler;
|
|
7685
7678
|
var _this = this;
|
|
7686
7679
|
return __generator(this, function (_a) {
|
|
7687
7680
|
messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;
|
|
7688
7681
|
if (!messageChannel) {
|
|
7689
|
-
throw new Error("connection_unavailable" /* CONNECTION_UNAVAILABLE */);
|
|
7682
|
+
throw new Error("connection_unavailable" /* _MessageError.CONNECTION_UNAVAILABLE */);
|
|
7690
7683
|
}
|
|
7691
7684
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
7692
7685
|
var eventId = _generateEventId('', 20);
|
|
7693
7686
|
messageChannel.port1.start();
|
|
7694
7687
|
var ackTimer = setTimeout(function () {
|
|
7695
|
-
reject(new Error("unsupported_event" /* UNSUPPORTED_EVENT */));
|
|
7688
|
+
reject(new Error("unsupported_event" /* _MessageError.UNSUPPORTED_EVENT */));
|
|
7696
7689
|
}, timeout);
|
|
7697
7690
|
handler = {
|
|
7698
7691
|
messageChannel: messageChannel,
|
|
@@ -7702,14 +7695,14 @@ var Sender = /** @class */ (function () {
|
|
|
7702
7695
|
return;
|
|
7703
7696
|
}
|
|
7704
7697
|
switch (messageEvent.data.status) {
|
|
7705
|
-
case "ack" /* ACK */:
|
|
7698
|
+
case "ack" /* _Status.ACK */:
|
|
7706
7699
|
// The receiver should ACK first.
|
|
7707
7700
|
clearTimeout(ackTimer);
|
|
7708
7701
|
completionTimer = setTimeout(function () {
|
|
7709
|
-
reject(new Error("timeout" /* TIMEOUT */));
|
|
7710
|
-
}, 3000 /* COMPLETION */);
|
|
7702
|
+
reject(new Error("timeout" /* _MessageError.TIMEOUT */));
|
|
7703
|
+
}, 3000 /* _TimeoutDuration.COMPLETION */);
|
|
7711
7704
|
break;
|
|
7712
|
-
case "done" /* DONE */:
|
|
7705
|
+
case "done" /* _Status.DONE */:
|
|
7713
7706
|
// Once the receiver's handlers are finished we will get the results.
|
|
7714
7707
|
clearTimeout(completionTimer);
|
|
7715
7708
|
resolve(messageEvent.data.response);
|
|
@@ -7717,7 +7710,7 @@ var Sender = /** @class */ (function () {
|
|
|
7717
7710
|
default:
|
|
7718
7711
|
clearTimeout(ackTimer);
|
|
7719
7712
|
clearTimeout(completionTimer);
|
|
7720
|
-
reject(new Error("invalid_response" /* INVALID_RESPONSE */));
|
|
7713
|
+
reject(new Error("invalid_response" /* _MessageError.INVALID_RESPONSE */));
|
|
7721
7714
|
break;
|
|
7722
7715
|
}
|
|
7723
7716
|
}
|
|
@@ -7949,7 +7942,7 @@ var _POLLING_INTERVAL_MS = 800;
|
|
|
7949
7942
|
var _TRANSACTION_RETRY_COUNT = 3;
|
|
7950
7943
|
var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
7951
7944
|
function IndexedDBLocalPersistence() {
|
|
7952
|
-
this.type = "LOCAL" /* LOCAL */;
|
|
7945
|
+
this.type = "LOCAL" /* PersistenceType.LOCAL */;
|
|
7953
7946
|
this._shouldAllowMigration = true;
|
|
7954
7947
|
this.listeners = {};
|
|
7955
7948
|
this.localCache = {};
|
|
@@ -8036,7 +8029,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
8036
8029
|
return __generator(this, function (_a) {
|
|
8037
8030
|
this.receiver = Receiver._getInstance(_getWorkerGlobalScope());
|
|
8038
8031
|
// Refresh from persistence if we receive a KeyChanged message.
|
|
8039
|
-
this.receiver._subscribe("keyChanged" /* KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
8032
|
+
this.receiver._subscribe("keyChanged" /* _EventType.KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
8040
8033
|
var keys;
|
|
8041
8034
|
return __generator(this, function (_a) {
|
|
8042
8035
|
switch (_a.label) {
|
|
@@ -8050,9 +8043,9 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
8050
8043
|
});
|
|
8051
8044
|
}); });
|
|
8052
8045
|
// Let the sender know that we are listening so they give us more timeout.
|
|
8053
|
-
this.receiver._subscribe("ping" /* PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
8046
|
+
this.receiver._subscribe("ping" /* _EventType.PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
8054
8047
|
return __generator(this, function (_a) {
|
|
8055
|
-
return [2 /*return*/, ["keyChanged" /* KEY_CHANGED */]];
|
|
8048
|
+
return [2 /*return*/, ["keyChanged" /* _EventType.KEY_CHANGED */]];
|
|
8056
8049
|
});
|
|
8057
8050
|
}); });
|
|
8058
8051
|
return [2 /*return*/];
|
|
@@ -8083,14 +8076,14 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
8083
8076
|
return [2 /*return*/];
|
|
8084
8077
|
}
|
|
8085
8078
|
this.sender = new Sender(this.activeServiceWorker);
|
|
8086
|
-
return [4 /*yield*/, this.sender._send("ping" /* PING */, {}, 800 /* LONG_ACK */)];
|
|
8079
|
+
return [4 /*yield*/, this.sender._send("ping" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */)];
|
|
8087
8080
|
case 2:
|
|
8088
8081
|
results = _d.sent();
|
|
8089
8082
|
if (!results) {
|
|
8090
8083
|
return [2 /*return*/];
|
|
8091
8084
|
}
|
|
8092
8085
|
if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&
|
|
8093
|
-
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* KEY_CHANGED */))) {
|
|
8086
|
+
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* _EventType.KEY_CHANGED */))) {
|
|
8094
8087
|
this.serviceWorkerReceiverAvailable = true;
|
|
8095
8088
|
}
|
|
8096
8089
|
return [2 /*return*/];
|
|
@@ -8120,11 +8113,11 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
8120
8113
|
_b.label = 1;
|
|
8121
8114
|
case 1:
|
|
8122
8115
|
_b.trys.push([1, 3, , 4]);
|
|
8123
|
-
return [4 /*yield*/, this.sender._send("keyChanged" /* KEY_CHANGED */, { key: key },
|
|
8116
|
+
return [4 /*yield*/, this.sender._send("keyChanged" /* _EventType.KEY_CHANGED */, { key: key },
|
|
8124
8117
|
// Use long timeout if receiver has previously responded to a ping from us.
|
|
8125
8118
|
this.serviceWorkerReceiverAvailable
|
|
8126
|
-
? 800 /* LONG_ACK */
|
|
8127
|
-
: 50 /* ACK */)];
|
|
8119
|
+
? 800 /* _TimeoutDuration.LONG_ACK */
|
|
8120
|
+
: 50 /* _TimeoutDuration.ACK */)];
|
|
8128
8121
|
case 2:
|
|
8129
8122
|
_b.sent();
|
|
8130
8123
|
return [3 /*break*/, 4];
|
|
@@ -8351,10 +8344,10 @@ var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
|
8351
8344
|
* limitations under the License.
|
|
8352
8345
|
*/
|
|
8353
8346
|
function startSignInPhoneMfa(auth, request) {
|
|
8354
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:start" /* START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8347
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:start" /* Endpoint.START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8355
8348
|
}
|
|
8356
8349
|
function finalizeSignInPhoneMfa(auth, request) {
|
|
8357
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:finalize" /* FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8350
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
8358
8351
|
}
|
|
8359
8352
|
|
|
8360
8353
|
/**
|
|
@@ -8377,7 +8370,7 @@ function getRecaptchaParams(auth) {
|
|
|
8377
8370
|
return __awaiter(this, void 0, void 0, function () {
|
|
8378
8371
|
return __generator(this, function (_a) {
|
|
8379
8372
|
switch (_a.label) {
|
|
8380
|
-
case 0: return [4 /*yield*/, _performApiRequest(auth, "GET" /* GET */, "/v1/recaptchaParams" /* GET_RECAPTCHA_PARAM */)];
|
|
8373
|
+
case 0: return [4 /*yield*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)];
|
|
8381
8374
|
case 1: return [2 /*return*/, ((_a.sent()).recaptchaSiteKey || '')];
|
|
8382
8375
|
}
|
|
8383
8376
|
});
|
|
@@ -8411,7 +8404,7 @@ function _loadJS(url) {
|
|
|
8411
8404
|
el.setAttribute('src', url);
|
|
8412
8405
|
el.onload = resolve;
|
|
8413
8406
|
el.onerror = function (e) {
|
|
8414
|
-
var error = _createError("internal-error" /* INTERNAL_ERROR */);
|
|
8407
|
+
var error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8415
8408
|
error.customData = e;
|
|
8416
8409
|
reject(error);
|
|
8417
8410
|
};
|
|
@@ -8421,7 +8414,7 @@ function _loadJS(url) {
|
|
|
8421
8414
|
});
|
|
8422
8415
|
}
|
|
8423
8416
|
function _generateCallbackName(prefix) {
|
|
8424
|
-
return "__"
|
|
8417
|
+
return "__".concat(prefix).concat(Math.floor(Math.random() * 1000000));
|
|
8425
8418
|
}
|
|
8426
8419
|
|
|
8427
8420
|
/**
|
|
@@ -8492,7 +8485,7 @@ var MockWidget = /** @class */ (function () {
|
|
|
8492
8485
|
var container = typeof containerOrId === 'string'
|
|
8493
8486
|
? document.getElementById(containerOrId)
|
|
8494
8487
|
: containerOrId;
|
|
8495
|
-
_assert(container, "argument-error" /* ARGUMENT_ERROR */, { appName: appName });
|
|
8488
|
+
_assert(container, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, { appName: appName });
|
|
8496
8489
|
this.container = container;
|
|
8497
8490
|
this.isVisible = this.params.size !== 'invisible';
|
|
8498
8491
|
if (this.isVisible) {
|
|
@@ -8600,20 +8593,20 @@ var ReCaptchaLoaderImpl = /** @class */ (function () {
|
|
|
8600
8593
|
ReCaptchaLoaderImpl.prototype.load = function (auth, hl) {
|
|
8601
8594
|
var _this = this;
|
|
8602
8595
|
if (hl === void 0) { hl = ''; }
|
|
8603
|
-
_assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8596
|
+
_assert(isHostLanguageValid(hl), auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8604
8597
|
if (this.shouldResolveImmediately(hl)) {
|
|
8605
8598
|
return Promise.resolve(_window().grecaptcha);
|
|
8606
8599
|
}
|
|
8607
8600
|
return new Promise(function (resolve, reject) {
|
|
8608
8601
|
var networkTimeout = _window().setTimeout(function () {
|
|
8609
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
8602
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
8610
8603
|
}, NETWORK_TIMEOUT_DELAY.get());
|
|
8611
8604
|
_window()[_JSLOAD_CALLBACK] = function () {
|
|
8612
8605
|
_window().clearTimeout(networkTimeout);
|
|
8613
8606
|
delete _window()[_JSLOAD_CALLBACK];
|
|
8614
8607
|
var recaptcha = _window().grecaptcha;
|
|
8615
8608
|
if (!recaptcha) {
|
|
8616
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
8609
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
8617
8610
|
return;
|
|
8618
8611
|
}
|
|
8619
8612
|
// Wrap the greptcha render function so that we know if the developer has
|
|
@@ -8627,14 +8620,14 @@ var ReCaptchaLoaderImpl = /** @class */ (function () {
|
|
|
8627
8620
|
_this.hostLanguage = hl;
|
|
8628
8621
|
resolve(recaptcha);
|
|
8629
8622
|
};
|
|
8630
|
-
var url = RECAPTCHA_BASE
|
|
8623
|
+
var url = "".concat(RECAPTCHA_BASE, "?").concat(querystring({
|
|
8631
8624
|
onload: _JSLOAD_CALLBACK,
|
|
8632
8625
|
render: 'explicit',
|
|
8633
8626
|
hl: hl
|
|
8634
|
-
});
|
|
8627
|
+
}));
|
|
8635
8628
|
_loadJS(url).catch(function () {
|
|
8636
8629
|
clearTimeout(networkTimeout);
|
|
8637
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
8630
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
8638
8631
|
});
|
|
8639
8632
|
});
|
|
8640
8633
|
};
|
|
@@ -8738,11 +8731,11 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8738
8731
|
this.recaptcha = null;
|
|
8739
8732
|
this.auth = _castAuth(authExtern);
|
|
8740
8733
|
this.isInvisible = this.parameters.size === 'invisible';
|
|
8741
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
8734
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
8742
8735
|
var container = typeof containerOrId === 'string'
|
|
8743
8736
|
? document.getElementById(containerOrId)
|
|
8744
8737
|
: containerOrId;
|
|
8745
|
-
_assert(container, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8738
|
+
_assert(container, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8746
8739
|
this.container = container;
|
|
8747
8740
|
this.parameters.callback = this.makeTokenCallback(this.parameters.callback);
|
|
8748
8741
|
this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting
|
|
@@ -8836,9 +8829,9 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8836
8829
|
}
|
|
8837
8830
|
};
|
|
8838
8831
|
RecaptchaVerifier.prototype.validateStartingState = function () {
|
|
8839
|
-
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8840
|
-
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8841
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
8832
|
+
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8833
|
+
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8834
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
8842
8835
|
};
|
|
8843
8836
|
RecaptchaVerifier.prototype.makeTokenCallback = function (existing) {
|
|
8844
8837
|
var _this = this;
|
|
@@ -8856,7 +8849,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8856
8849
|
};
|
|
8857
8850
|
};
|
|
8858
8851
|
RecaptchaVerifier.prototype.assertNotDestroyed = function () {
|
|
8859
|
-
_assert(!this.destroyed, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8852
|
+
_assert(!this.destroyed, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8860
8853
|
};
|
|
8861
8854
|
RecaptchaVerifier.prototype.makeRenderPromise = function () {
|
|
8862
8855
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -8886,7 +8879,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8886
8879
|
return __generator(this, function (_b) {
|
|
8887
8880
|
switch (_b.label) {
|
|
8888
8881
|
case 0:
|
|
8889
|
-
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8882
|
+
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8890
8883
|
return [4 /*yield*/, domReady()];
|
|
8891
8884
|
case 1:
|
|
8892
8885
|
_b.sent();
|
|
@@ -8897,7 +8890,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8897
8890
|
return [4 /*yield*/, getRecaptchaParams(this.auth)];
|
|
8898
8891
|
case 3:
|
|
8899
8892
|
siteKey = _b.sent();
|
|
8900
|
-
_assert(siteKey, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8893
|
+
_assert(siteKey, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8901
8894
|
this.parameters.sitekey = siteKey;
|
|
8902
8895
|
return [2 /*return*/];
|
|
8903
8896
|
}
|
|
@@ -8905,7 +8898,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
8905
8898
|
});
|
|
8906
8899
|
};
|
|
8907
8900
|
RecaptchaVerifier.prototype.getAssertedRecaptcha = function () {
|
|
8908
|
-
_assert(this.recaptcha, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8901
|
+
_assert(this.recaptcha, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8909
8902
|
return this.recaptcha;
|
|
8910
8903
|
};
|
|
8911
8904
|
return RecaptchaVerifier;
|
|
@@ -9020,7 +9013,7 @@ function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
|
9020
9013
|
switch (_a.label) {
|
|
9021
9014
|
case 0:
|
|
9022
9015
|
userInternal = getModularInstance(user);
|
|
9023
|
-
return [4 /*yield*/, _assertLinkedStatus(false, userInternal, "phone" /* PHONE */)];
|
|
9016
|
+
return [4 /*yield*/, _assertLinkedStatus(false, userInternal, "phone" /* ProviderId.PHONE */)];
|
|
9024
9017
|
case 1:
|
|
9025
9018
|
_a.sent();
|
|
9026
9019
|
return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier))];
|
|
@@ -9077,8 +9070,8 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
9077
9070
|
_b.label = 2;
|
|
9078
9071
|
case 2:
|
|
9079
9072
|
_b.trys.push([2, , 10, 11]);
|
|
9080
|
-
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
9081
|
-
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
9073
|
+
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
9074
|
+
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
9082
9075
|
phoneInfoOptions = void 0;
|
|
9083
9076
|
if (typeof options === 'string') {
|
|
9084
9077
|
phoneInfoOptions = {
|
|
@@ -9091,7 +9084,7 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
9091
9084
|
if (!('session' in phoneInfoOptions)) return [3 /*break*/, 7];
|
|
9092
9085
|
session = phoneInfoOptions.session;
|
|
9093
9086
|
if (!('phoneNumber' in phoneInfoOptions)) return [3 /*break*/, 4];
|
|
9094
|
-
_assert(session.type === "enroll" /* ENROLL */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9087
|
+
_assert(session.type === "enroll" /* MultiFactorSessionType.ENROLL */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9095
9088
|
return [4 /*yield*/, startEnrollPhoneMfa(auth, {
|
|
9096
9089
|
idToken: session.credential,
|
|
9097
9090
|
phoneEnrollmentInfo: {
|
|
@@ -9103,10 +9096,10 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
9103
9096
|
response = _b.sent();
|
|
9104
9097
|
return [2 /*return*/, response.phoneSessionInfo.sessionInfo];
|
|
9105
9098
|
case 4:
|
|
9106
|
-
_assert(session.type === "signin" /* SIGN_IN */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9099
|
+
_assert(session.type === "signin" /* MultiFactorSessionType.SIGN_IN */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9107
9100
|
mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||
|
|
9108
9101
|
phoneInfoOptions.multiFactorUid;
|
|
9109
|
-
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* MISSING_MFA_INFO */);
|
|
9102
|
+
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */);
|
|
9110
9103
|
return [4 /*yield*/, startSignInPhoneMfa(auth, {
|
|
9111
9104
|
mfaPendingCredential: session.credential,
|
|
9112
9105
|
mfaEnrollmentId: mfaEnrollmentId,
|
|
@@ -9327,9 +9320,9 @@ var PhoneAuthProvider = /** @class */ (function () {
|
|
|
9327
9320
|
return null;
|
|
9328
9321
|
};
|
|
9329
9322
|
/** Always set to {@link ProviderId}.PHONE. */
|
|
9330
|
-
PhoneAuthProvider.PROVIDER_ID = "phone" /* PHONE */;
|
|
9323
|
+
PhoneAuthProvider.PROVIDER_ID = "phone" /* ProviderId.PHONE */;
|
|
9331
9324
|
/** Always set to {@link SignInMethod}.PHONE. */
|
|
9332
|
-
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* PHONE */;
|
|
9325
|
+
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* SignInMethod.PHONE */;
|
|
9333
9326
|
return PhoneAuthProvider;
|
|
9334
9327
|
}());
|
|
9335
9328
|
|
|
@@ -9358,7 +9351,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
9358
9351
|
if (resolverOverride) {
|
|
9359
9352
|
return _getInstance(resolverOverride);
|
|
9360
9353
|
}
|
|
9361
|
-
_assert(auth._popupRedirectResolver, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
9354
|
+
_assert(auth._popupRedirectResolver, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
9362
9355
|
return auth._popupRedirectResolver;
|
|
9363
9356
|
}
|
|
9364
9357
|
|
|
@@ -9381,7 +9374,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
9381
9374
|
var IdpCredential = /** @class */ (function (_super) {
|
|
9382
9375
|
__extends(IdpCredential, _super);
|
|
9383
9376
|
function IdpCredential(params) {
|
|
9384
|
-
var _this = _super.call(this, "custom" /* CUSTOM */, "custom" /* CUSTOM */) || this;
|
|
9377
|
+
var _this = _super.call(this, "custom" /* ProviderId.CUSTOM */, "custom" /* ProviderId.CUSTOM */) || this;
|
|
9385
9378
|
_this.params = params;
|
|
9386
9379
|
return _this;
|
|
9387
9380
|
}
|
|
@@ -9416,7 +9409,7 @@ function _signIn(params) {
|
|
|
9416
9409
|
}
|
|
9417
9410
|
function _reauth(params) {
|
|
9418
9411
|
var auth = params.auth, user = params.user;
|
|
9419
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9412
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9420
9413
|
return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
|
|
9421
9414
|
}
|
|
9422
9415
|
function _link(params) {
|
|
@@ -9424,7 +9417,7 @@ function _link(params) {
|
|
|
9424
9417
|
var auth, user;
|
|
9425
9418
|
return __generator(this, function (_a) {
|
|
9426
9419
|
auth = params.auth, user = params.user;
|
|
9427
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9420
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9428
9421
|
return [2 /*return*/, _link$1(user, new IdpCredential(params), params.bypassAuthState)];
|
|
9429
9422
|
});
|
|
9430
9423
|
});
|
|
@@ -9532,17 +9525,17 @@ var AbstractPopupRedirectOperation = /** @class */ (function () {
|
|
|
9532
9525
|
};
|
|
9533
9526
|
AbstractPopupRedirectOperation.prototype.getIdpTask = function (type) {
|
|
9534
9527
|
switch (type) {
|
|
9535
|
-
case "signInViaPopup" /* SIGN_IN_VIA_POPUP */:
|
|
9536
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
9528
|
+
case "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */:
|
|
9529
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
9537
9530
|
return _signIn;
|
|
9538
|
-
case "linkViaPopup" /* LINK_VIA_POPUP */:
|
|
9539
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
9531
|
+
case "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */:
|
|
9532
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
9540
9533
|
return _link;
|
|
9541
|
-
case "reauthViaPopup" /* REAUTH_VIA_POPUP */:
|
|
9542
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
9534
|
+
case "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */:
|
|
9535
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
9543
9536
|
return _reauth;
|
|
9544
9537
|
default:
|
|
9545
|
-
_fail(this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9538
|
+
_fail(this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9546
9539
|
}
|
|
9547
9540
|
};
|
|
9548
9541
|
AbstractPopupRedirectOperation.prototype.resolve = function (cred) {
|
|
@@ -9618,7 +9611,7 @@ function signInWithPopup(auth, provider, resolver) {
|
|
|
9618
9611
|
authInternal = _castAuth(auth);
|
|
9619
9612
|
_assertInstanceOf(auth, provider, FederatedAuthProvider);
|
|
9620
9613
|
resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
9621
|
-
action = new PopupOperation(authInternal, "signInViaPopup" /* SIGN_IN_VIA_POPUP */, provider, resolverInternal);
|
|
9614
|
+
action = new PopupOperation(authInternal, "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */, provider, resolverInternal);
|
|
9622
9615
|
return [2 /*return*/, action.executeNotNull()];
|
|
9623
9616
|
});
|
|
9624
9617
|
});
|
|
@@ -9655,7 +9648,7 @@ function reauthenticateWithPopup(user, provider, resolver) {
|
|
|
9655
9648
|
userInternal = getModularInstance(user);
|
|
9656
9649
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
9657
9650
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
9658
|
-
action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
9651
|
+
action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
9659
9652
|
return [2 /*return*/, action.executeNotNull()];
|
|
9660
9653
|
});
|
|
9661
9654
|
});
|
|
@@ -9691,7 +9684,7 @@ function linkWithPopup(user, provider, resolver) {
|
|
|
9691
9684
|
userInternal = getModularInstance(user);
|
|
9692
9685
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
9693
9686
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
9694
|
-
action = new PopupOperation(userInternal.auth, "linkViaPopup" /* LINK_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
9687
|
+
action = new PopupOperation(userInternal.auth, "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
9695
9688
|
return [2 /*return*/, action.executeNotNull()];
|
|
9696
9689
|
});
|
|
9697
9690
|
});
|
|
@@ -9722,7 +9715,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
9722
9715
|
case 0: return [4 /*yield*/, this.execute()];
|
|
9723
9716
|
case 1:
|
|
9724
9717
|
result = _a.sent();
|
|
9725
|
-
_assert(result, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
9718
|
+
_assert(result, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
9726
9719
|
return [2 /*return*/, result];
|
|
9727
9720
|
}
|
|
9728
9721
|
});
|
|
@@ -9755,7 +9748,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
9755
9748
|
});
|
|
9756
9749
|
this.resolver._isIframeWebStorageSupported(this.auth, function (isSupported) {
|
|
9757
9750
|
if (!isSupported) {
|
|
9758
|
-
_this.reject(_createError(_this.auth, "web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */));
|
|
9751
|
+
_this.reject(_createError(_this.auth, "web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */));
|
|
9759
9752
|
}
|
|
9760
9753
|
});
|
|
9761
9754
|
// Handle user closure. Notice this does *not* use await
|
|
@@ -9774,7 +9767,7 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
9774
9767
|
configurable: true
|
|
9775
9768
|
});
|
|
9776
9769
|
PopupOperation.prototype.cancel = function () {
|
|
9777
|
-
this.reject(_createError(this.auth, "cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */));
|
|
9770
|
+
this.reject(_createError(this.auth, "cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */));
|
|
9778
9771
|
};
|
|
9779
9772
|
PopupOperation.prototype.cleanUp = function () {
|
|
9780
9773
|
if (this.authWindow) {
|
|
@@ -9797,8 +9790,8 @@ var PopupOperation = /** @class */ (function (_super) {
|
|
|
9797
9790
|
// call could still be in flight.
|
|
9798
9791
|
_this.pollId = window.setTimeout(function () {
|
|
9799
9792
|
_this.pollId = null;
|
|
9800
|
-
_this.reject(_createError(_this.auth, "popup-closed-by-user" /* POPUP_CLOSED_BY_USER */));
|
|
9801
|
-
}, 2000 /* AUTH_EVENT */);
|
|
9793
|
+
_this.reject(_createError(_this.auth, "popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */));
|
|
9794
|
+
}, 2000 /* _Timeout.AUTH_EVENT */);
|
|
9802
9795
|
return;
|
|
9803
9796
|
}
|
|
9804
9797
|
_this.pollId = window.setTimeout(poll, _POLL_WINDOW_CLOSE_TIMEOUT.get());
|
|
@@ -9836,10 +9829,10 @@ var RedirectAction = /** @class */ (function (_super) {
|
|
|
9836
9829
|
function RedirectAction(auth, resolver, bypassAuthState) {
|
|
9837
9830
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
9838
9831
|
var _this = _super.call(this, auth, [
|
|
9839
|
-
"signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */,
|
|
9840
|
-
"linkViaRedirect" /* LINK_VIA_REDIRECT */,
|
|
9841
|
-
"reauthViaRedirect" /* REAUTH_VIA_REDIRECT */,
|
|
9842
|
-
"unknown" /* UNKNOWN */
|
|
9832
|
+
"signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */,
|
|
9833
|
+
"linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */,
|
|
9834
|
+
"reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */,
|
|
9835
|
+
"unknown" /* AuthEventType.UNKNOWN */
|
|
9843
9836
|
], resolver, undefined, bypassAuthState) || this;
|
|
9844
9837
|
_this.eventId = null;
|
|
9845
9838
|
return _this;
|
|
@@ -9898,10 +9891,10 @@ var RedirectAction = /** @class */ (function (_super) {
|
|
|
9898
9891
|
return __generator(this, function (_a) {
|
|
9899
9892
|
switch (_a.label) {
|
|
9900
9893
|
case 0:
|
|
9901
|
-
if (event.type === "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */) {
|
|
9894
|
+
if (event.type === "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */) {
|
|
9902
9895
|
return [2 /*return*/, _super.prototype.onAuthEvent.call(this, event)];
|
|
9903
9896
|
}
|
|
9904
|
-
else if (event.type === "unknown" /* UNKNOWN */) {
|
|
9897
|
+
else if (event.type === "unknown" /* AuthEventType.UNKNOWN */) {
|
|
9905
9898
|
// This is a sentinel value indicating there's no pending redirect
|
|
9906
9899
|
this.resolve(null);
|
|
9907
9900
|
return [2 /*return*/];
|
|
@@ -10045,7 +10038,7 @@ function _signInWithRedirect(auth, provider, resolver) {
|
|
|
10045
10038
|
return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, authInternal)];
|
|
10046
10039
|
case 1:
|
|
10047
10040
|
_a.sent();
|
|
10048
|
-
return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */)];
|
|
10041
|
+
return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */)];
|
|
10049
10042
|
}
|
|
10050
10043
|
});
|
|
10051
10044
|
});
|
|
@@ -10096,7 +10089,7 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
10096
10089
|
return [4 /*yield*/, prepareUserForRedirect(userInternal)];
|
|
10097
10090
|
case 2:
|
|
10098
10091
|
eventId = _a.sent();
|
|
10099
|
-
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */, eventId)];
|
|
10092
|
+
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId)];
|
|
10100
10093
|
}
|
|
10101
10094
|
});
|
|
10102
10095
|
});
|
|
@@ -10147,7 +10140,7 @@ function _linkWithRedirect(user, provider, resolver) {
|
|
|
10147
10140
|
return [4 /*yield*/, prepareUserForRedirect(userInternal)];
|
|
10148
10141
|
case 3:
|
|
10149
10142
|
eventId = _a.sent();
|
|
10150
|
-
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* LINK_VIA_REDIRECT */, eventId)];
|
|
10143
|
+
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId)];
|
|
10151
10144
|
}
|
|
10152
10145
|
});
|
|
10153
10146
|
});
|
|
@@ -10235,7 +10228,7 @@ function prepareUserForRedirect(user) {
|
|
|
10235
10228
|
return __generator(this, function (_a) {
|
|
10236
10229
|
switch (_a.label) {
|
|
10237
10230
|
case 0:
|
|
10238
|
-
eventId = _generateEventId(user.uid
|
|
10231
|
+
eventId = _generateEventId("".concat(user.uid, ":::"));
|
|
10239
10232
|
user._redirectEventId = eventId;
|
|
10240
10233
|
return [4 /*yield*/, user.auth._setRedirectUser(user)];
|
|
10241
10234
|
case 1:
|
|
@@ -10320,7 +10313,7 @@ var AuthEventManager = /** @class */ (function () {
|
|
|
10320
10313
|
var _a;
|
|
10321
10314
|
if (event.error && !isNullRedirectEvent(event)) {
|
|
10322
10315
|
var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
|
|
10323
|
-
"internal-error" /* INTERNAL_ERROR */;
|
|
10316
|
+
"internal-error" /* AuthErrorCode.INTERNAL_ERROR */;
|
|
10324
10317
|
consumer.onError(_createError(this.auth, code));
|
|
10325
10318
|
}
|
|
10326
10319
|
else {
|
|
@@ -10350,16 +10343,16 @@ function eventUid(e) {
|
|
|
10350
10343
|
}
|
|
10351
10344
|
function isNullRedirectEvent(_a) {
|
|
10352
10345
|
var type = _a.type, error = _a.error;
|
|
10353
|
-
return (type === "unknown" /* UNKNOWN */ &&
|
|
10354
|
-
(error === null || error === void 0 ? void 0 : error.code) === "auth/"
|
|
10346
|
+
return (type === "unknown" /* AuthEventType.UNKNOWN */ &&
|
|
10347
|
+
(error === null || error === void 0 ? void 0 : error.code) === "auth/".concat("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */));
|
|
10355
10348
|
}
|
|
10356
10349
|
function isRedirectEvent(event) {
|
|
10357
10350
|
switch (event.type) {
|
|
10358
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
10359
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
10360
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
10351
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
10352
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
10353
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
10361
10354
|
return true;
|
|
10362
|
-
case "unknown" /* UNKNOWN */:
|
|
10355
|
+
case "unknown" /* AuthEventType.UNKNOWN */:
|
|
10363
10356
|
return isNullRedirectEvent(event);
|
|
10364
10357
|
default:
|
|
10365
10358
|
return false;
|
|
@@ -10386,7 +10379,7 @@ function _getProjectConfig(auth, request) {
|
|
|
10386
10379
|
if (request === void 0) { request = {}; }
|
|
10387
10380
|
return __awaiter(this, void 0, void 0, function () {
|
|
10388
10381
|
return __generator(this, function (_a) {
|
|
10389
|
-
return [2 /*return*/, _performApiRequest(auth, "GET" /* GET */, "/v1/projects" /* GET_PROJECT_CONFIG */, request)];
|
|
10382
|
+
return [2 /*return*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/projects" /* Endpoint.GET_PROJECT_CONFIG */, request)];
|
|
10390
10383
|
});
|
|
10391
10384
|
});
|
|
10392
10385
|
}
|
|
@@ -10434,7 +10427,7 @@ function _validateOrigin(auth) {
|
|
|
10434
10427
|
}
|
|
10435
10428
|
}
|
|
10436
10429
|
// In the old SDK, this error also provides helpful messages.
|
|
10437
|
-
_fail(auth, "unauthorized-domain" /* INVALID_ORIGIN */);
|
|
10430
|
+
_fail(auth, "unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */);
|
|
10438
10431
|
return [2 /*return*/];
|
|
10439
10432
|
}
|
|
10440
10433
|
});
|
|
@@ -10505,7 +10498,7 @@ function resetUnloadedGapiModules() {
|
|
|
10505
10498
|
// Loaded modules.
|
|
10506
10499
|
beacon.H[hint].L = beacon.H[hint].L || [];
|
|
10507
10500
|
// Set requested modules to a copy of the loaded modules.
|
|
10508
|
-
beacon.H[hint].r = __spreadArray([], beacon.H[hint].L);
|
|
10501
|
+
beacon.H[hint].r = __spreadArray([], beacon.H[hint].L, true);
|
|
10509
10502
|
// Clear pending callbacks.
|
|
10510
10503
|
if (beacon.CP) {
|
|
10511
10504
|
for (var i = 0; i < beacon.CP.length; i++) {
|
|
@@ -10536,7 +10529,7 @@ function loadGapi(auth) {
|
|
|
10536
10529
|
// failed attempt.
|
|
10537
10530
|
// Timeout when gapi.iframes.Iframe not loaded.
|
|
10538
10531
|
resetUnloadedGapiModules();
|
|
10539
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
10532
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
10540
10533
|
},
|
|
10541
10534
|
timeout: NETWORK_TIMEOUT.get()
|
|
10542
10535
|
});
|
|
@@ -10564,11 +10557,11 @@ function loadGapi(auth) {
|
|
|
10564
10557
|
}
|
|
10565
10558
|
else {
|
|
10566
10559
|
// Gapi loader failed, throw error.
|
|
10567
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
10560
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
10568
10561
|
}
|
|
10569
10562
|
};
|
|
10570
10563
|
// Load GApi loader.
|
|
10571
|
-
return _loadJS("https://apis.google.com/js/api.js?onload="
|
|
10564
|
+
return _loadJS("https://apis.google.com/js/api.js?onload=".concat(cbName))
|
|
10572
10565
|
.catch(function (e) { return reject(e); });
|
|
10573
10566
|
}
|
|
10574
10567
|
}).catch(function (error) {
|
|
@@ -10615,16 +10608,16 @@ var IFRAME_ATTRIBUTES = {
|
|
|
10615
10608
|
// Map from apiHost to endpoint ID for passing into iframe. In current SDK, apiHost can be set to
|
|
10616
10609
|
// anything (not from a list of endpoints with IDs as in legacy), so this is the closest we can get.
|
|
10617
10610
|
var EID_FROM_APIHOST = new Map([
|
|
10618
|
-
["identitytoolkit.googleapis.com" /* API_HOST */, 'p'],
|
|
10611
|
+
["identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */, 'p'],
|
|
10619
10612
|
['staging-identitytoolkit.sandbox.googleapis.com', 's'],
|
|
10620
10613
|
['test-identitytoolkit.sandbox.googleapis.com', 't'] // test
|
|
10621
10614
|
]);
|
|
10622
10615
|
function getIframeUrl(auth) {
|
|
10623
10616
|
var config = auth.config;
|
|
10624
|
-
_assert(config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
10617
|
+
_assert(config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
10625
10618
|
var url = config.emulator
|
|
10626
10619
|
? _emulatorUrl(config, EMULATED_IFRAME_PATH)
|
|
10627
|
-
: "https://"
|
|
10620
|
+
: "https://".concat(auth.config.authDomain, "/").concat(IFRAME_PATH);
|
|
10628
10621
|
var params = {
|
|
10629
10622
|
apiKey: config.apiKey,
|
|
10630
10623
|
appName: auth.name,
|
|
@@ -10638,7 +10631,7 @@ function getIframeUrl(auth) {
|
|
|
10638
10631
|
if (frameworks.length) {
|
|
10639
10632
|
params.fw = frameworks.join(',');
|
|
10640
10633
|
}
|
|
10641
|
-
return url
|
|
10634
|
+
return "".concat(url, "?").concat(querystring(params).slice(1));
|
|
10642
10635
|
}
|
|
10643
10636
|
function _openIframe(auth) {
|
|
10644
10637
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -10650,7 +10643,7 @@ function _openIframe(auth) {
|
|
|
10650
10643
|
case 1:
|
|
10651
10644
|
context = _a.sent();
|
|
10652
10645
|
gapi = _window().gapi;
|
|
10653
|
-
_assert(gapi, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
10646
|
+
_assert(gapi, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
10654
10647
|
return [2 /*return*/, context.open({
|
|
10655
10648
|
where: document.body,
|
|
10656
10649
|
url: getIframeUrl(auth),
|
|
@@ -10673,7 +10666,7 @@ function _openIframe(auth) {
|
|
|
10673
10666
|
})];
|
|
10674
10667
|
case 1:
|
|
10675
10668
|
_a.sent();
|
|
10676
|
-
networkError = _createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
10669
|
+
networkError = _createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
10677
10670
|
networkErrorTimer = _window().setTimeout(function () {
|
|
10678
10671
|
reject(networkError);
|
|
10679
10672
|
}, PING_TIMEOUT.get());
|
|
@@ -10739,8 +10732,7 @@ function _open(auth, url, name, width, height) {
|
|
|
10739
10732
|
var top = Math.max((window.screen.availHeight - height) / 2, 0).toString();
|
|
10740
10733
|
var left = Math.max((window.screen.availWidth - width) / 2, 0).toString();
|
|
10741
10734
|
var target = '';
|
|
10742
|
-
var options = __assign(__assign({}, BASE_POPUP_OPTIONS), { width: width.toString(), height: height.toString(), top: top,
|
|
10743
|
-
left: left });
|
|
10735
|
+
var options = __assign(__assign({}, BASE_POPUP_OPTIONS), { width: width.toString(), height: height.toString(), top: top, left: left });
|
|
10744
10736
|
// Chrome iOS 7 and 8 is returning an undefined popup win when target is
|
|
10745
10737
|
// specified, even though the popup is not necessarily blocked.
|
|
10746
10738
|
var ua = getUA().toLowerCase();
|
|
@@ -10756,7 +10748,7 @@ function _open(auth, url, name, width, height) {
|
|
|
10756
10748
|
}
|
|
10757
10749
|
var optionsString = Object.entries(options).reduce(function (accum, _a) {
|
|
10758
10750
|
var key = _a[0], value = _a[1];
|
|
10759
|
-
return ""
|
|
10751
|
+
return "".concat(accum).concat(key, "=").concat(value, ",");
|
|
10760
10752
|
}, '');
|
|
10761
10753
|
if (_isIOSStandalone(ua) && target !== '_self') {
|
|
10762
10754
|
openAsNewWindowIOS(url || '', target);
|
|
@@ -10765,7 +10757,7 @@ function _open(auth, url, name, width, height) {
|
|
|
10765
10757
|
// about:blank getting sanitized causing browsers like IE/Edge to display
|
|
10766
10758
|
// brief error message before redirecting to handler.
|
|
10767
10759
|
var newWin = window.open(url || '', target, optionsString);
|
|
10768
|
-
_assert(newWin, auth, "popup-blocked" /* POPUP_BLOCKED */);
|
|
10760
|
+
_assert(newWin, auth, "popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */);
|
|
10769
10761
|
// Flaky on IE edge, encapsulate with a try and catch.
|
|
10770
10762
|
try {
|
|
10771
10763
|
newWin.focus();
|
|
@@ -10811,8 +10803,8 @@ var WIDGET_PATH = '__/auth/handler';
|
|
|
10811
10803
|
*/
|
|
10812
10804
|
var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
|
|
10813
10805
|
function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
|
|
10814
|
-
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
10815
|
-
_assert(auth.config.apiKey, auth, "invalid-api-key" /* INVALID_API_KEY */);
|
|
10806
|
+
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
10807
|
+
_assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
|
|
10816
10808
|
var params = {
|
|
10817
10809
|
apiKey: auth.config.apiKey,
|
|
10818
10810
|
appName: auth.name,
|
|
@@ -10851,12 +10843,12 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
10851
10843
|
delete paramsDict[key];
|
|
10852
10844
|
}
|
|
10853
10845
|
}
|
|
10854
|
-
return getHandlerBase(auth)
|
|
10846
|
+
return "".concat(getHandlerBase(auth), "?").concat(querystring(paramsDict).slice(1));
|
|
10855
10847
|
}
|
|
10856
10848
|
function getHandlerBase(_a) {
|
|
10857
10849
|
var config = _a.config;
|
|
10858
10850
|
if (!config.emulator) {
|
|
10859
|
-
return "https://"
|
|
10851
|
+
return "https://".concat(config.authDomain, "/").concat(WIDGET_PATH);
|
|
10860
10852
|
}
|
|
10861
10853
|
return _emulatorUrl(config, EMULATOR_WIDGET_PATH);
|
|
10862
10854
|
}
|
|
@@ -10949,10 +10941,10 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
10949
10941
|
iframe = _a.sent();
|
|
10950
10942
|
manager = new AuthEventManager(auth);
|
|
10951
10943
|
iframe.register('authEvent', function (iframeEvent) {
|
|
10952
|
-
_assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" /* INVALID_AUTH_EVENT */);
|
|
10944
|
+
_assert(iframeEvent === null || iframeEvent === void 0 ? void 0 : iframeEvent.authEvent, auth, "invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */);
|
|
10953
10945
|
// TODO: Consider splitting redirect and popup events earlier on
|
|
10954
10946
|
var handled = manager.onEvent(iframeEvent.authEvent);
|
|
10955
|
-
return { status: handled ? "ACK" /* ACK */ : "ERROR" /* ERROR */ };
|
|
10947
|
+
return { status: handled ? "ACK" /* GapiOutcome.ACK */ : "ERROR" /* GapiOutcome.ERROR */ };
|
|
10956
10948
|
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
10957
10949
|
this.eventManagers[auth._key()] = { manager: manager };
|
|
10958
10950
|
this.iframes[auth._key()] = iframe;
|
|
@@ -10969,7 +10961,7 @@ var BrowserPopupRedirectResolver = /** @class */ (function () {
|
|
|
10969
10961
|
if (isSupported !== undefined) {
|
|
10970
10962
|
cb(!!isSupported);
|
|
10971
10963
|
}
|
|
10972
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
10964
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
10973
10965
|
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
10974
10966
|
};
|
|
10975
10967
|
BrowserPopupRedirectResolver.prototype._originValidation = function (auth) {
|
|
@@ -11003,9 +10995,9 @@ var MultiFactorAssertionImpl = /** @class */ (function () {
|
|
|
11003
10995
|
}
|
|
11004
10996
|
MultiFactorAssertionImpl.prototype._process = function (auth, session, displayName) {
|
|
11005
10997
|
switch (session.type) {
|
|
11006
|
-
case "enroll" /* ENROLL */:
|
|
10998
|
+
case "enroll" /* MultiFactorSessionType.ENROLL */:
|
|
11007
10999
|
return this._finalizeEnroll(auth, session.credential, displayName);
|
|
11008
|
-
case "signin" /* SIGN_IN */:
|
|
11000
|
+
case "signin" /* MultiFactorSessionType.SIGN_IN */:
|
|
11009
11001
|
return this._finalizeSignIn(auth, session.credential);
|
|
11010
11002
|
default:
|
|
11011
11003
|
return debugFail('unexpected MultiFactorSessionType');
|
|
@@ -11022,7 +11014,7 @@ var MultiFactorAssertionImpl = /** @class */ (function () {
|
|
|
11022
11014
|
var PhoneMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
11023
11015
|
__extends(PhoneMultiFactorAssertionImpl, _super);
|
|
11024
11016
|
function PhoneMultiFactorAssertionImpl(credential) {
|
|
11025
|
-
var _this = _super.call(this, "phone" /* PHONE */) || this;
|
|
11017
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */) || this;
|
|
11026
11018
|
_this.credential = credential;
|
|
11027
11019
|
return _this;
|
|
11028
11020
|
}
|
|
@@ -11073,7 +11065,7 @@ var PhoneMultiFactorGenerator = /** @class */ (function () {
|
|
|
11073
11065
|
}());
|
|
11074
11066
|
|
|
11075
11067
|
var name = "@firebase/auth";
|
|
11076
|
-
var version = "0.
|
|
11068
|
+
var version = "0.21.0";
|
|
11077
11069
|
|
|
11078
11070
|
/**
|
|
11079
11071
|
* @license
|
|
@@ -11128,8 +11120,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
11128
11120
|
return;
|
|
11129
11121
|
}
|
|
11130
11122
|
var unsubscribe = this.auth.onIdTokenChanged(function (user) {
|
|
11131
|
-
|
|
11132
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
11123
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
11133
11124
|
});
|
|
11134
11125
|
this.internalListeners.set(listener, unsubscribe);
|
|
11135
11126
|
this.updateProactiveRefresh();
|
|
@@ -11145,7 +11136,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
11145
11136
|
this.updateProactiveRefresh();
|
|
11146
11137
|
};
|
|
11147
11138
|
AuthInterop.prototype.assertAuthConfigured = function () {
|
|
11148
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
11139
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
11149
11140
|
};
|
|
11150
11141
|
AuthInterop.prototype.updateProactiveRefresh = function () {
|
|
11151
11142
|
if (this.internalListeners.size > 0) {
|
|
@@ -11176,13 +11167,13 @@ var AuthInterop = /** @class */ (function () {
|
|
|
11176
11167
|
*/
|
|
11177
11168
|
function getVersionForPlatform(clientPlatform) {
|
|
11178
11169
|
switch (clientPlatform) {
|
|
11179
|
-
case "Node" /* NODE */:
|
|
11170
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
11180
11171
|
return 'node';
|
|
11181
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
11172
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
11182
11173
|
return 'rn';
|
|
11183
|
-
case "Worker" /* WORKER */:
|
|
11174
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
11184
11175
|
return 'webworker';
|
|
11185
|
-
case "Cordova" /* CORDOVA */:
|
|
11176
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
11186
11177
|
return 'cordova';
|
|
11187
11178
|
default:
|
|
11188
11179
|
return undefined;
|
|
@@ -11190,48 +11181,48 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
11190
11181
|
}
|
|
11191
11182
|
/** @internal */
|
|
11192
11183
|
function registerAuth(clientPlatform) {
|
|
11193
|
-
_registerComponent(new Component("auth" /* AUTH */, function (container, _a) {
|
|
11184
|
+
_registerComponent(new Component("auth" /* _ComponentName.AUTH */, function (container, _a) {
|
|
11194
11185
|
var deps = _a.options;
|
|
11195
11186
|
var app = container.getProvider('app').getImmediate();
|
|
11196
11187
|
var heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
11197
11188
|
var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
|
|
11198
11189
|
return (function (app, heartbeatServiceProvider) {
|
|
11199
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
11190
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
11200
11191
|
// Auth domain is optional if IdP sign in isn't being used
|
|
11201
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
11192
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
11202
11193
|
appName: app.name
|
|
11203
11194
|
});
|
|
11204
11195
|
var config = {
|
|
11205
11196
|
apiKey: apiKey,
|
|
11206
11197
|
authDomain: authDomain,
|
|
11207
11198
|
clientPlatform: clientPlatform,
|
|
11208
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
11209
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
11210
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
11199
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
11200
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
11201
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
11211
11202
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
11212
11203
|
};
|
|
11213
11204
|
var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
11214
11205
|
_initializeAuthInstance(authInstance, deps);
|
|
11215
11206
|
return authInstance;
|
|
11216
11207
|
})(app, heartbeatServiceProvider);
|
|
11217
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
11208
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
11218
11209
|
/**
|
|
11219
11210
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
11220
11211
|
* For why we do this, See go/firebase-next-auth-init
|
|
11221
11212
|
*/
|
|
11222
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
11213
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
11223
11214
|
/**
|
|
11224
11215
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
11225
11216
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
11226
11217
|
*/
|
|
11227
11218
|
.setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {
|
|
11228
|
-
var authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
11219
|
+
var authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
11229
11220
|
authInternalProvider.initialize();
|
|
11230
11221
|
}));
|
|
11231
|
-
_registerComponent(new Component("auth-internal" /* AUTH_INTERNAL */, function (container) {
|
|
11232
|
-
var auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
11222
|
+
_registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, function (container) {
|
|
11223
|
+
var auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
11233
11224
|
return (function (auth) { return new AuthInterop(auth); })(auth);
|
|
11234
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
11225
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
11235
11226
|
registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
11236
11227
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
11237
11228
|
registerVersion(name, version, 'esm5');
|
|
@@ -11283,7 +11274,7 @@ var mintCookieFactory = function (url) { return function (user) { return __await
|
|
|
11283
11274
|
method: idToken ? 'POST' : 'DELETE',
|
|
11284
11275
|
headers: idToken
|
|
11285
11276
|
? {
|
|
11286
|
-
'Authorization': "Bearer "
|
|
11277
|
+
'Authorization': "Bearer ".concat(idToken)
|
|
11287
11278
|
}
|
|
11288
11279
|
: {}
|
|
11289
11280
|
})];
|
|
@@ -11325,11 +11316,11 @@ function getAuth(app) {
|
|
|
11325
11316
|
}
|
|
11326
11317
|
var authEmulatorHost = getDefaultEmulatorHost('auth');
|
|
11327
11318
|
if (authEmulatorHost) {
|
|
11328
|
-
connectAuthEmulator(auth, "http://"
|
|
11319
|
+
connectAuthEmulator(auth, "http://".concat(authEmulatorHost));
|
|
11329
11320
|
}
|
|
11330
11321
|
return auth;
|
|
11331
11322
|
}
|
|
11332
|
-
registerAuth("Browser" /* BROWSER */);
|
|
11323
|
+
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
11333
11324
|
|
|
11334
11325
|
export { signInWithCustomToken as $, ActionCodeOperation as A, debugErrorMap as B, prodErrorMap as C, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as D, initializeAuth as E, FactorId as F, connectAuthEmulator as G, AuthCredential as H, EmailAuthCredential as I, OAuthCredential as J, PhoneAuthCredential as K, inMemoryPersistence as L, EmailAuthProvider as M, FacebookAuthProvider as N, OperationType as O, PhoneAuthProvider as P, GoogleAuthProvider as Q, RecaptchaVerifier as R, SignInMethod as S, GithubAuthProvider as T, OAuthProvider as U, SAMLAuthProvider as V, TwitterAuthProvider as W, signInAnonymously as X, signInWithCredential as Y, linkWithCredential as Z, reauthenticateWithCredential as _, browserSessionPersistence as a, sendPasswordResetEmail as a0, confirmPasswordReset as a1, applyActionCode as a2, checkActionCode as a3, verifyPasswordResetCode as a4, createUserWithEmailAndPassword as a5, signInWithEmailAndPassword as a6, sendSignInLinkToEmail as a7, isSignInWithEmailLink as a8, signInWithEmailLink as a9, _persistenceKeyName as aA, _clearRedirectOutcomes as aB, _getRedirectResult as aC, _overrideRedirectResult as aD, _castAuth as aE, UserImpl as aF, AuthImpl as aG, _getClientVersion as aH, _generateEventId as aI, AuthPopup as aJ, FetchProvider as aK, SAMLAuthCredential as aL, fetchSignInMethodsForEmail as aa, sendEmailVerification as ab, verifyBeforeUpdateEmail as ac, ActionCodeURL as ad, parseActionCodeURL as ae, updateProfile as af, updateEmail as ag, updatePassword as ah, getIdToken as ai, getIdTokenResult as aj, unlink as ak, getAdditionalUserInfo as al, reload as am, getMultiFactorResolver as an, multiFactor as ao, _isIOS as ap, _isAndroid as aq, _fail as ar, _getRedirectUrl as as, debugAssert as at, _getProjectConfig as au, _isIOS7Or8 as av, _assert as aw, _createError as ax, AuthEventManager as ay, _getInstance as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, getAuth as n, ProviderId as o, setPersistence as p, onIdTokenChanged as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, beforeAuthStateChanged as t, updatePhoneNumber as u, onAuthStateChanged as v, useDeviceLanguage as w, updateCurrentUser as x, signOut as y, deleteUser as z };
|
|
11335
|
-
//# sourceMappingURL=index-
|
|
11326
|
+
//# sourceMappingURL=index-ef8e1de2.js.map
|