@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 @@ const ActionCodeOperation = {
|
|
|
121
121
|
*/
|
|
122
122
|
function _debugErrorMap() {
|
|
123
123
|
return {
|
|
124
|
-
["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.',
|
|
125
|
-
["argument-error" /* ARGUMENT_ERROR */]: '',
|
|
126
|
-
["app-not-authorized" /* APP_NOT_AUTHORIZED */]: "This app, identified by the domain where it's hosted, is not " +
|
|
124
|
+
["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */]: 'This operation is restricted to administrators only.',
|
|
125
|
+
["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */]: '',
|
|
126
|
+
["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
|
-
["app-not-installed" /* APP_NOT_INSTALLED */]: 'The requested mobile application corresponding to the identifier (' +
|
|
129
|
+
["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
|
-
["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */]: 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
132
|
+
["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
|
-
["code-expired" /* CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
135
|
+
["code-expired" /* AuthErrorCode.CODE_EXPIRED */]: 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
136
136
|
'again.',
|
|
137
|
-
["cordova-not-ready" /* CORDOVA_NOT_READY */]: 'Cordova framework is not ready.',
|
|
138
|
-
["cors-unsupported" /* CORS_UNSUPPORTED */]: 'This browser is not supported.',
|
|
139
|
-
["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.',
|
|
140
|
-
["custom-token-mismatch" /* CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.',
|
|
141
|
-
["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
137
|
+
["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */]: 'Cordova framework is not ready.',
|
|
138
|
+
["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */]: 'This browser is not supported.',
|
|
139
|
+
["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */]: 'This credential is already associated with a different user account.',
|
|
140
|
+
["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */]: 'The custom token corresponds to a different audience.',
|
|
141
|
+
["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
|
-
["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
|
+
["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
|
-
["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */]: 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
146
|
+
["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
|
-
["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.',
|
|
149
|
-
["email-already-in-use" /* EMAIL_EXISTS */]: 'The email address is already in use by another account.',
|
|
150
|
-
["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */]: 'Auth instance has already been used to make a network call. Auth can ' +
|
|
148
|
+
["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */]: 'Multi-factor users must always have a verified email.',
|
|
149
|
+
["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */]: 'The email address is already in use by another account.',
|
|
150
|
+
["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
|
-
["expired-action-code" /* EXPIRED_OOB_CODE */]: 'The action code has expired.',
|
|
154
|
-
["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
155
|
-
["internal-error" /* INTERNAL_ERROR */]: 'An internal AuthError has occurred.',
|
|
156
|
-
["invalid-app-credential" /* INVALID_APP_CREDENTIAL */]: 'The phone verification request contains an invalid application verifier.' +
|
|
153
|
+
["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */]: 'The action code has expired.',
|
|
154
|
+
["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */]: 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
155
|
+
["internal-error" /* AuthErrorCode.INTERNAL_ERROR */]: 'An internal AuthError has occurred.',
|
|
156
|
+
["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
|
-
["invalid-app-id" /* INVALID_APP_ID */]: 'The mobile app identifier is not registed for the current project.',
|
|
159
|
-
["invalid-user-token" /* INVALID_AUTH */]: "This user's credential isn't valid for this project. This can happen " +
|
|
158
|
+
["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */]: 'The mobile app identifier is not registed for the current project.',
|
|
159
|
+
["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
|
-
["invalid-auth-event" /* INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
163
|
-
["invalid-verification-code" /* INVALID_CODE */]: 'The SMS verification code used to create the phone auth credential is ' +
|
|
162
|
+
["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
163
|
+
["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
|
-
["invalid-continue-uri" /* INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.',
|
|
167
|
-
["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */]: 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
166
|
+
["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */]: 'The continue URL provided in the request is invalid.',
|
|
167
|
+
["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
|
-
["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.',
|
|
172
|
-
["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
173
|
-
["invalid-email" /* INVALID_EMAIL */]: 'The email address is badly formatted.',
|
|
174
|
-
["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
175
|
-
["invalid-api-key" /* INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',
|
|
176
|
-
["invalid-cert-hash" /* INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',
|
|
177
|
-
["invalid-credential" /* INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',
|
|
178
|
-
["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
171
|
+
["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */]: 'The custom token format is incorrect. Please check the documentation.',
|
|
172
|
+
["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */]: 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
173
|
+
["invalid-email" /* AuthErrorCode.INVALID_EMAIL */]: 'The email address is badly formatted.',
|
|
174
|
+
["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */]: 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
175
|
+
["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */]: 'Your API key is invalid, please check you have copied it correctly.',
|
|
176
|
+
["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */]: 'The SHA-1 certificate hash provided is invalid.',
|
|
177
|
+
["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */]: 'The supplied auth credential is malformed or has expired.',
|
|
178
|
+
["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */]: 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
179
179
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
180
|
-
["invalid-multi-factor-session" /* INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
181
|
-
["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
180
|
+
["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */]: 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
181
|
+
["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */]: 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
182
182
|
'only supports OAuth providers.',
|
|
183
|
-
["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */]: 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
183
|
+
["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
|
-
["unauthorized-domain" /* INVALID_ORIGIN */]: 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
185
|
+
["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
|
-
["invalid-action-code" /* INVALID_OOB_CODE */]: 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
187
|
+
["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
|
-
["wrong-password" /* INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.',
|
|
190
|
-
["invalid-persistence-type" /* INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
191
|
-
["invalid-phone-number" /* INVALID_PHONE_NUMBER */]: 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
189
|
+
["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */]: 'The password is invalid or the user does not have a password.',
|
|
190
|
+
["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */]: 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
191
|
+
["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
|
-
["invalid-provider-id" /* INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.',
|
|
196
|
-
["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */]: 'The email corresponding to this action failed to send as the provided ' +
|
|
195
|
+
["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */]: 'The specified provider ID is invalid.',
|
|
196
|
+
["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
|
-
["invalid-sender" /* INVALID_SENDER */]: 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
198
|
+
["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
|
-
["invalid-verification-id" /* INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.',
|
|
201
|
-
["invalid-tenant-id" /* INVALID_TENANT_ID */]: "The Auth instance's tenant ID is invalid.",
|
|
202
|
-
["login-blocked" /* LOGIN_BLOCKED */]: 'Login blocked by user-provided method: {$originalMessage}',
|
|
203
|
-
["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
|
-
["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */]: 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
200
|
+
["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */]: 'The verification ID used to create the phone auth credential is invalid.',
|
|
201
|
+
["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */]: "The Auth instance's tenant ID is invalid.",
|
|
202
|
+
["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */]: 'Login blocked by user-provided method: {$originalMessage}',
|
|
203
|
+
["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
|
+
["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
|
-
["missing-app-credential" /* MISSING_APP_CREDENTIAL */]: 'The phone verification request is missing an application verifier ' +
|
|
206
|
+
["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
|
-
["missing-verification-code" /* MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.',
|
|
209
|
-
["missing-continue-uri" /* MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.',
|
|
210
|
-
["missing-iframe-start" /* MISSING_IFRAME_START */]: 'An internal AuthError has occurred.',
|
|
211
|
-
["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
212
|
-
["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */]: 'The request does not contain a valid nonce. This can occur if the ' +
|
|
208
|
+
["missing-verification-code" /* AuthErrorCode.MISSING_CODE */]: 'The phone auth credential was created with an empty SMS verification code.',
|
|
209
|
+
["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */]: 'A continue URL must be provided in the request.',
|
|
210
|
+
["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */]: 'An internal AuthError has occurred.',
|
|
211
|
+
["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */]: 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
212
|
+
["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
|
-
["missing-multi-factor-info" /* MISSING_MFA_INFO */]: 'No second factor identifier is provided.',
|
|
216
|
-
["missing-multi-factor-session" /* MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',
|
|
217
|
-
["missing-phone-number" /* MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',
|
|
218
|
-
["missing-verification-id" /* MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.',
|
|
219
|
-
["app-deleted" /* MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.',
|
|
220
|
-
["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.',
|
|
221
|
-
["multi-factor-auth-required" /* MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
222
|
-
["account-exists-with-different-credential" /* NEED_CONFIRMATION */]: 'An account already exists with the same email address but different ' +
|
|
215
|
+
["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */]: 'No second factor identifier is provided.',
|
|
216
|
+
["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */]: 'The request is missing proof of first factor successful sign-in.',
|
|
217
|
+
["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */]: 'To send verification codes, provide a phone number for the recipient.',
|
|
218
|
+
["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */]: 'The phone auth credential was created with an empty verification ID.',
|
|
219
|
+
["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */]: 'This instance of FirebaseApp has been deleted.',
|
|
220
|
+
["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */]: 'The user does not have a second factor matching the identifier provided.',
|
|
221
|
+
["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */]: 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
222
|
+
["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
|
-
["network-request-failed" /* NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
226
|
-
["no-auth-event" /* NO_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
227
|
-
["no-such-provider" /* NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.',
|
|
228
|
-
["null-user" /* NULL_USER */]: 'A null user object was provided as the argument for an operation which ' +
|
|
225
|
+
["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */]: 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
226
|
+
["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */]: 'An internal AuthError has occurred.',
|
|
227
|
+
["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */]: 'User was not linked to an account with the given provider.',
|
|
228
|
+
["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
|
-
["operation-not-allowed" /* OPERATION_NOT_ALLOWED */]: 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
230
|
+
["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
|
-
["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */]: 'This operation is not supported in the environment this application is ' +
|
|
233
|
+
["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
|
-
["popup-blocked" /* POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
237
|
-
["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.',
|
|
238
|
-
["provider-already-linked" /* PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.',
|
|
239
|
-
["quota-exceeded" /* QUOTA_EXCEEDED */]: "The project's quota for this operation has been exceeded.",
|
|
240
|
-
["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.',
|
|
241
|
-
["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.',
|
|
242
|
-
["rejected-credential" /* REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.',
|
|
243
|
-
["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.',
|
|
244
|
-
["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
245
|
-
["tenant-id-mismatch" /* TENANT_ID_MISMATCH */]: "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
246
|
-
["timeout" /* TIMEOUT */]: 'The operation has timed out.',
|
|
247
|
-
["user-token-expired" /* TOKEN_EXPIRED */]: "The user's credential is no longer valid. The user must sign in again.",
|
|
248
|
-
["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: 'We have blocked all requests from this device due to unusual activity. ' +
|
|
236
|
+
["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */]: 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
237
|
+
["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */]: 'The popup has been closed by the user before finalizing the operation.',
|
|
238
|
+
["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */]: 'User can only be linked to one identity for the given provider.',
|
|
239
|
+
["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */]: "The project's quota for this operation has been exceeded.",
|
|
240
|
+
["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */]: 'The redirect operation has been cancelled by the user before finalizing.',
|
|
241
|
+
["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */]: 'A redirect sign-in operation is already pending.',
|
|
242
|
+
["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */]: 'The request contains malformed or mismatching credentials.',
|
|
243
|
+
["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */]: 'The second factor is already enrolled on this account.',
|
|
244
|
+
["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */]: 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
245
|
+
["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */]: "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
246
|
+
["timeout" /* AuthErrorCode.TIMEOUT */]: 'The operation has timed out.',
|
|
247
|
+
["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */]: "The user's credential is no longer valid. The user must sign in again.",
|
|
248
|
+
["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
|
-
["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */]: 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
250
|
+
["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
|
-
["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
|
-
["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.',
|
|
254
|
-
["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.',
|
|
255
|
-
["unverified-email" /* UNVERIFIED_EMAIL */]: 'The operation requires a verified email.',
|
|
256
|
-
["user-cancelled" /* USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.',
|
|
257
|
-
["user-not-found" /* USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' +
|
|
252
|
+
["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
|
+
["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */]: 'The current environment does not support the specified persistence type.',
|
|
254
|
+
["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */]: 'This operation is not supported in a multi-tenant context.',
|
|
255
|
+
["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */]: 'The operation requires a verified email.',
|
|
256
|
+
["user-cancelled" /* AuthErrorCode.USER_CANCELLED */]: 'The user did not grant your application the permissions it requested.',
|
|
257
|
+
["user-not-found" /* AuthErrorCode.USER_DELETED */]: 'There is no user record corresponding to this identifier. The user may ' +
|
|
258
258
|
'have been deleted.',
|
|
259
|
-
["user-disabled" /* USER_DISABLED */]: 'The user account has been disabled by an administrator.',
|
|
260
|
-
["user-mismatch" /* USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.',
|
|
261
|
-
["user-signed-out" /* USER_SIGNED_OUT */]: '',
|
|
262
|
-
["weak-password" /* WEAK_PASSWORD */]: 'The password must be 6 characters long or more.',
|
|
263
|
-
["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
264
|
-
["already-initialized" /* ALREADY_INITIALIZED */]: 'initializeAuth() has already been called with ' +
|
|
259
|
+
["user-disabled" /* AuthErrorCode.USER_DISABLED */]: 'The user account has been disabled by an administrator.',
|
|
260
|
+
["user-mismatch" /* AuthErrorCode.USER_MISMATCH */]: 'The supplied credentials do not correspond to the previously signed in user.',
|
|
261
|
+
["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */]: '',
|
|
262
|
+
["weak-password" /* AuthErrorCode.WEAK_PASSWORD */]: 'The password must be 6 characters long or more.',
|
|
263
|
+
["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */]: 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
264
|
+
["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.'
|
|
@@ -272,7 +272,7 @@ function _prodErrorMap() {
|
|
|
272
272
|
// nature of this error, developers will never be able to see the message
|
|
273
273
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
274
274
|
return {
|
|
275
|
-
["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */]: 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
275
|
+
["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 ' +
|
|
276
276
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
277
277
|
'starting any other Firebase SDK.'
|
|
278
278
|
};
|
|
@@ -579,7 +579,7 @@ function initializeAuth(app, deps) {
|
|
|
579
579
|
return auth;
|
|
580
580
|
}
|
|
581
581
|
else {
|
|
582
|
-
_fail(auth, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
582
|
+
_fail(auth, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
const auth = provider.initialize({ options: deps });
|
|
@@ -707,7 +707,7 @@ class Delay {
|
|
|
707
707
|
get() {
|
|
708
708
|
if (!_isOnline()) {
|
|
709
709
|
// Pick the shorter timeout.
|
|
710
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
710
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
711
711
|
}
|
|
712
712
|
// If running in a mobile environment, return the long delay, otherwise
|
|
713
713
|
// return the short delay.
|
|
@@ -818,64 +818,64 @@ class FetchProvider {
|
|
|
818
818
|
*/
|
|
819
819
|
const SERVER_ERROR_MAP = {
|
|
820
820
|
// Custom token errors.
|
|
821
|
-
["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */]: "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
821
|
+
["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */]: "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
822
822
|
// This can only happen if the SDK sends a bad request.
|
|
823
|
-
["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */]: "internal-error" /* INTERNAL_ERROR */,
|
|
823
|
+
["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
824
824
|
// Create Auth URI errors.
|
|
825
|
-
["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */]: "invalid-email" /* INVALID_EMAIL */,
|
|
825
|
+
["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */]: "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
826
826
|
// This can only happen if the SDK sends a bad request.
|
|
827
|
-
["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */]: "internal-error" /* INTERNAL_ERROR */,
|
|
827
|
+
["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
828
828
|
// Sign in with email and password errors (some apply to sign up too).
|
|
829
|
-
["INVALID_PASSWORD" /* INVALID_PASSWORD */]: "wrong-password" /* INVALID_PASSWORD */,
|
|
829
|
+
["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */]: "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
830
830
|
// This can only happen if the SDK sends a bad request.
|
|
831
|
-
["MISSING_PASSWORD" /* MISSING_PASSWORD */]: "internal-error" /* INTERNAL_ERROR */,
|
|
831
|
+
["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
832
832
|
// Sign up with email and password errors.
|
|
833
|
-
["EMAIL_EXISTS" /* EMAIL_EXISTS */]: "email-already-in-use" /* EMAIL_EXISTS */,
|
|
834
|
-
["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
833
|
+
["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */]: "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
834
|
+
["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */]: "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
835
835
|
// Verify assertion for sign in with credential errors:
|
|
836
|
-
["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
837
|
-
["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
838
|
-
["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
836
|
+
["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
837
|
+
["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
838
|
+
["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */]: "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
839
839
|
// This can only happen if the SDK sends a bad request.
|
|
840
|
-
["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */]: "internal-error" /* INTERNAL_ERROR */,
|
|
840
|
+
["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
841
841
|
// Send Password reset email errors:
|
|
842
|
-
["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */]: "user-not-found" /* USER_DELETED */,
|
|
843
|
-
["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */]: "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
844
|
-
["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */]: "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
845
|
-
["INVALID_OOB_CODE" /* INVALID_OOB_CODE */]: "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
842
|
+
["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
843
|
+
["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
844
|
+
["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */]: "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
845
|
+
["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */]: "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
846
846
|
// This can only happen if the SDK sends a bad request.
|
|
847
|
-
["MISSING_OOB_CODE" /* MISSING_OOB_CODE */]: "internal-error" /* INTERNAL_ERROR */,
|
|
847
|
+
["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
848
848
|
// Operations that require ID token in request:
|
|
849
|
-
["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
850
|
-
["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */]: "invalid-user-token" /* INVALID_AUTH */,
|
|
851
|
-
["TOKEN_EXPIRED" /* TOKEN_EXPIRED */]: "user-token-expired" /* TOKEN_EXPIRED */,
|
|
852
|
-
["USER_NOT_FOUND" /* USER_NOT_FOUND */]: "user-token-expired" /* TOKEN_EXPIRED */,
|
|
849
|
+
["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */]: "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
850
|
+
["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */]: "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
851
|
+
["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
852
|
+
["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
853
853
|
// Other errors.
|
|
854
|
-
["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */]: "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
854
|
+
["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */]: "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
855
855
|
// Phone Auth related errors.
|
|
856
|
-
["INVALID_CODE" /* INVALID_CODE */]: "invalid-verification-code" /* INVALID_CODE */,
|
|
857
|
-
["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */]: "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
858
|
-
["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
859
|
-
["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */]: "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
860
|
-
["SESSION_EXPIRED" /* SESSION_EXPIRED */]: "code-expired" /* CODE_EXPIRED */,
|
|
856
|
+
["INVALID_CODE" /* ServerError.INVALID_CODE */]: "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
857
|
+
["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */]: "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
858
|
+
["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */]: "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
859
|
+
["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */]: "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
860
|
+
["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */]: "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
861
861
|
// Other action code errors when additional settings passed.
|
|
862
862
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
863
863
|
// This is OK as this error will be caught by client side validation.
|
|
864
|
-
["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */]: "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
865
|
-
["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */]: "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
864
|
+
["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */]: "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
865
|
+
["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */]: "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
866
866
|
// getProjectConfig errors when clientId is passed.
|
|
867
|
-
["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */]: "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
867
|
+
["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */]: "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
868
868
|
// User actions (sign-up or deletion) disabled errors.
|
|
869
|
-
["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */]: "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
869
|
+
["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */]: "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
870
870
|
// Multi factor related errors.
|
|
871
|
-
["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */]: "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
872
|
-
["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */]: "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
873
|
-
["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */]: "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
874
|
-
["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */]: "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
875
|
-
["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
876
|
-
["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
871
|
+
["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */]: "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
872
|
+
["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */]: "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
873
|
+
["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */]: "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
874
|
+
["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */]: "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
875
|
+
["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */]: "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
876
|
+
["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */]: "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
877
877
|
// Blocking functions related errors.
|
|
878
|
-
["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* INTERNAL_ERROR */
|
|
878
|
+
["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */]: "internal-error" /* AuthErrorCode.INTERNAL_ERROR */
|
|
879
879
|
};
|
|
880
880
|
|
|
881
881
|
/**
|
|
@@ -906,7 +906,7 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
906
906
|
let body = {};
|
|
907
907
|
let params = {};
|
|
908
908
|
if (request) {
|
|
909
|
-
if (method === "GET" /* GET */) {
|
|
909
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
910
910
|
params = request;
|
|
911
911
|
}
|
|
912
912
|
else {
|
|
@@ -917,9 +917,9 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
917
917
|
}
|
|
918
918
|
const query = querystring(Object.assign({ key: auth.config.apiKey }, params)).slice(1);
|
|
919
919
|
const headers = await auth._getAdditionalHeaders();
|
|
920
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
920
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
921
921
|
if (auth.languageCode) {
|
|
922
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
922
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
923
923
|
}
|
|
924
924
|
return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), Object.assign({ method,
|
|
925
925
|
headers, referrerPolicy: 'no-referrer' }, body));
|
|
@@ -939,7 +939,7 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
939
939
|
networkTimeout.clearNetworkTimeout();
|
|
940
940
|
const json = await response.json();
|
|
941
941
|
if ('needConfirmation' in json) {
|
|
942
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
942
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
943
943
|
}
|
|
944
944
|
if (response.ok && !('errorMessage' in json)) {
|
|
945
945
|
return json;
|
|
@@ -947,14 +947,14 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
947
947
|
else {
|
|
948
948
|
const errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
949
949
|
const [serverErrorCode, serverErrorMessage] = errorMessage.split(' : ');
|
|
950
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
951
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
950
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
951
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
952
952
|
}
|
|
953
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
954
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
953
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
954
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
955
955
|
}
|
|
956
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
957
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
956
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
957
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
958
958
|
}
|
|
959
959
|
const authError = errorMap[serverErrorCode] ||
|
|
960
960
|
serverErrorCode
|
|
@@ -972,13 +972,13 @@ async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
972
972
|
if (e instanceof FirebaseError) {
|
|
973
973
|
throw e;
|
|
974
974
|
}
|
|
975
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
975
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
async function _performSignInRequest(auth, method, path, request, customErrorMap = {}) {
|
|
979
979
|
const serverResponse = (await _performApiRequest(auth, method, path, request, customErrorMap));
|
|
980
980
|
if ('mfaPendingCredential' in serverResponse) {
|
|
981
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
981
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
982
982
|
_serverResponse: serverResponse
|
|
983
983
|
});
|
|
984
984
|
}
|
|
@@ -1000,7 +1000,7 @@ class NetworkTimeout {
|
|
|
1000
1000
|
this.timer = null;
|
|
1001
1001
|
this.promise = new Promise((_, reject) => {
|
|
1002
1002
|
this.timer = setTimeout(() => {
|
|
1003
|
-
return reject(_createError(this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1003
|
+
return reject(_createError(this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1004
1004
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1005
1005
|
});
|
|
1006
1006
|
}
|
|
@@ -1041,13 +1041,13 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1041
1041
|
* limitations under the License.
|
|
1042
1042
|
*/
|
|
1043
1043
|
async function deleteAccount(auth, request) {
|
|
1044
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request);
|
|
1044
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request);
|
|
1045
1045
|
}
|
|
1046
1046
|
async function deleteLinkedAccounts(auth, request) {
|
|
1047
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
1047
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
1048
1048
|
}
|
|
1049
1049
|
async function getAccountInfo(auth, request) {
|
|
1050
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request);
|
|
1050
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request);
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
/**
|
|
@@ -1132,7 +1132,7 @@ async function getIdTokenResult(user, forceRefresh = false) {
|
|
|
1132
1132
|
const userInternal = getModularInstance(user);
|
|
1133
1133
|
const token = await userInternal.getIdToken(forceRefresh);
|
|
1134
1134
|
const claims = _parseToken(token);
|
|
1135
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1135
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1136
1136
|
const firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1137
1137
|
const signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1138
1138
|
return {
|
|
@@ -1149,7 +1149,6 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1149
1149
|
return Number(seconds) * 1000;
|
|
1150
1150
|
}
|
|
1151
1151
|
function _parseToken(token) {
|
|
1152
|
-
var _a;
|
|
1153
1152
|
const [algorithm, payload, signature] = token.split('.');
|
|
1154
1153
|
if (algorithm === undefined ||
|
|
1155
1154
|
payload === undefined ||
|
|
@@ -1166,7 +1165,7 @@ function _parseToken(token) {
|
|
|
1166
1165
|
return JSON.parse(decoded);
|
|
1167
1166
|
}
|
|
1168
1167
|
catch (e) {
|
|
1169
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1168
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1170
1169
|
return null;
|
|
1171
1170
|
}
|
|
1172
1171
|
}
|
|
@@ -1175,9 +1174,9 @@ function _parseToken(token) {
|
|
|
1175
1174
|
*/
|
|
1176
1175
|
function _tokenExpiresIn(token) {
|
|
1177
1176
|
const parsedToken = _parseToken(token);
|
|
1178
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1179
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1180
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1177
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1178
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1179
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1181
1180
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1182
1181
|
}
|
|
1183
1182
|
|
|
@@ -1214,8 +1213,8 @@ async function _logoutIfInvalidated(user, promise, bypassAuthState = false) {
|
|
|
1214
1213
|
}
|
|
1215
1214
|
}
|
|
1216
1215
|
function isUserInvalidated({ code }) {
|
|
1217
|
-
return (code === `auth/${"user-disabled" /* USER_DISABLED */}` ||
|
|
1218
|
-
code === `auth/${"user-token-expired" /* TOKEN_EXPIRED */}`);
|
|
1216
|
+
return (code === `auth/${"user-disabled" /* AuthErrorCode.USER_DISABLED */}` ||
|
|
1217
|
+
code === `auth/${"user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */}`);
|
|
1219
1218
|
}
|
|
1220
1219
|
|
|
1221
1220
|
/**
|
|
@@ -1243,7 +1242,7 @@ class ProactiveRefresh {
|
|
|
1243
1242
|
// we can't cast properly in both environments.
|
|
1244
1243
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1245
1244
|
this.timerId = null;
|
|
1246
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1245
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1247
1246
|
}
|
|
1248
1247
|
_start() {
|
|
1249
1248
|
if (this.isRunning) {
|
|
@@ -1265,14 +1264,14 @@ class ProactiveRefresh {
|
|
|
1265
1264
|
var _a;
|
|
1266
1265
|
if (wasError) {
|
|
1267
1266
|
const interval = this.errorBackoff;
|
|
1268
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1267
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1269
1268
|
return interval;
|
|
1270
1269
|
}
|
|
1271
1270
|
else {
|
|
1272
1271
|
// Reset the error backoff
|
|
1273
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1272
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1274
1273
|
const expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1275
|
-
const interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1274
|
+
const interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1276
1275
|
return Math.max(0, interval);
|
|
1277
1276
|
}
|
|
1278
1277
|
}
|
|
@@ -1287,14 +1286,13 @@ class ProactiveRefresh {
|
|
|
1287
1286
|
}, interval);
|
|
1288
1287
|
}
|
|
1289
1288
|
async iteration() {
|
|
1290
|
-
var _a;
|
|
1291
1289
|
try {
|
|
1292
1290
|
await this.user.getIdToken(true);
|
|
1293
1291
|
}
|
|
1294
1292
|
catch (e) {
|
|
1295
1293
|
// Only retry on network errors
|
|
1296
|
-
if ((
|
|
1297
|
-
`auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
|
|
1294
|
+
if ((e === null || e === void 0 ? void 0 : e.code) ===
|
|
1295
|
+
`auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {
|
|
1298
1296
|
this.schedule(/* wasError */ true);
|
|
1299
1297
|
}
|
|
1300
1298
|
return;
|
|
@@ -1363,7 +1361,7 @@ async function _reloadWithoutSaving(user) {
|
|
|
1363
1361
|
const auth = user.auth;
|
|
1364
1362
|
const idToken = await user.getIdToken();
|
|
1365
1363
|
const response = await _logoutIfInvalidated(user, getAccountInfo(auth, { idToken }));
|
|
1366
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1364
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1367
1365
|
const coreAccount = response.users[0];
|
|
1368
1366
|
user._notifyReloadListener(coreAccount);
|
|
1369
1367
|
const newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1449,11 +1447,11 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1449
1447
|
'refresh_token': refreshToken
|
|
1450
1448
|
}).slice(1);
|
|
1451
1449
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1452
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, `key=${apiKey}`);
|
|
1450
|
+
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1453
1451
|
const headers = await auth._getAdditionalHeaders();
|
|
1454
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1452
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1455
1453
|
return FetchProvider.fetch()(url, {
|
|
1456
|
-
method: "POST" /* POST */,
|
|
1454
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1457
1455
|
headers,
|
|
1458
1456
|
body
|
|
1459
1457
|
});
|
|
@@ -1496,19 +1494,19 @@ class StsTokenManager {
|
|
|
1496
1494
|
}
|
|
1497
1495
|
get isExpired() {
|
|
1498
1496
|
return (!this.expirationTime ||
|
|
1499
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1497
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1500
1498
|
}
|
|
1501
1499
|
updateFromServerResponse(response) {
|
|
1502
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1503
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1504
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1500
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1501
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1502
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1505
1503
|
const expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1506
1504
|
? Number(response.expiresIn)
|
|
1507
1505
|
: _tokenExpiresIn(response.idToken);
|
|
1508
1506
|
this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
|
|
1509
1507
|
}
|
|
1510
1508
|
async getToken(auth, forceRefresh = false) {
|
|
1511
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1509
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1512
1510
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1513
1511
|
return this.accessToken;
|
|
1514
1512
|
}
|
|
@@ -1534,19 +1532,19 @@ class StsTokenManager {
|
|
|
1534
1532
|
const { refreshToken, accessToken, expirationTime } = object;
|
|
1535
1533
|
const manager = new StsTokenManager();
|
|
1536
1534
|
if (refreshToken) {
|
|
1537
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1535
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1538
1536
|
appName
|
|
1539
1537
|
});
|
|
1540
1538
|
manager.refreshToken = refreshToken;
|
|
1541
1539
|
}
|
|
1542
1540
|
if (accessToken) {
|
|
1543
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1541
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1544
1542
|
appName
|
|
1545
1543
|
});
|
|
1546
1544
|
manager.accessToken = accessToken;
|
|
1547
1545
|
}
|
|
1548
1546
|
if (expirationTime) {
|
|
1549
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1547
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1550
1548
|
appName
|
|
1551
1549
|
});
|
|
1552
1550
|
manager.expirationTime = expirationTime;
|
|
@@ -1590,13 +1588,13 @@ class StsTokenManager {
|
|
|
1590
1588
|
* limitations under the License.
|
|
1591
1589
|
*/
|
|
1592
1590
|
function assertStringOrUndefined(assertion, appName) {
|
|
1593
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName });
|
|
1591
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName });
|
|
1594
1592
|
}
|
|
1595
1593
|
class UserImpl {
|
|
1596
1594
|
constructor(_a) {
|
|
1597
1595
|
var { uid, auth, stsTokenManager } = _a, opt = __rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1598
1596
|
// For the user object, provider is always Firebase.
|
|
1599
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1597
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1600
1598
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1601
1599
|
this.reloadUserInfo = null;
|
|
1602
1600
|
this.reloadListener = null;
|
|
@@ -1616,7 +1614,7 @@ class UserImpl {
|
|
|
1616
1614
|
}
|
|
1617
1615
|
async getIdToken(forceRefresh) {
|
|
1618
1616
|
const accessToken = await _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh));
|
|
1619
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1617
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1620
1618
|
if (this.accessToken !== accessToken) {
|
|
1621
1619
|
this.accessToken = accessToken;
|
|
1622
1620
|
await this.auth._persistUserIfCurrent(this);
|
|
@@ -1634,7 +1632,7 @@ class UserImpl {
|
|
|
1634
1632
|
if (this === user) {
|
|
1635
1633
|
return;
|
|
1636
1634
|
}
|
|
1637
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1635
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1638
1636
|
this.displayName = user.displayName;
|
|
1639
1637
|
this.photoURL = user.photoURL;
|
|
1640
1638
|
this.email = user.email;
|
|
@@ -1651,7 +1649,7 @@ class UserImpl {
|
|
|
1651
1649
|
}
|
|
1652
1650
|
_onReload(callback) {
|
|
1653
1651
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1654
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1652
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1655
1653
|
this.reloadListener = callback;
|
|
1656
1654
|
if (this.reloadUserInfo) {
|
|
1657
1655
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -1718,13 +1716,13 @@ class UserImpl {
|
|
|
1718
1716
|
const createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1719
1717
|
const lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
1720
1718
|
const { uid, emailVerified, isAnonymous, providerData, stsTokenManager: plainObjectTokenManager } = object;
|
|
1721
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1719
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1722
1720
|
const stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
1723
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1721
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1724
1722
|
assertStringOrUndefined(displayName, auth.name);
|
|
1725
1723
|
assertStringOrUndefined(email, auth.name);
|
|
1726
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1727
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1724
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1725
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1728
1726
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
1729
1727
|
assertStringOrUndefined(photoURL, auth.name);
|
|
1730
1728
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -1792,7 +1790,7 @@ class UserImpl {
|
|
|
1792
1790
|
*/
|
|
1793
1791
|
class InMemoryPersistence {
|
|
1794
1792
|
constructor() {
|
|
1795
|
-
this.type = "NONE" /* NONE */;
|
|
1793
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
1796
1794
|
this.storage = {};
|
|
1797
1795
|
}
|
|
1798
1796
|
async _isAvailable() {
|
|
@@ -1842,7 +1840,7 @@ const inMemoryPersistence = InMemoryPersistence;
|
|
|
1842
1840
|
* limitations under the License.
|
|
1843
1841
|
*/
|
|
1844
1842
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
1845
|
-
return `${"firebase" /* PERSISTENCE */}:${key}:${apiKey}:${appName}`;
|
|
1843
|
+
return `${"firebase" /* Namespace.PERSISTENCE */}:${key}:${apiKey}:${appName}`;
|
|
1846
1844
|
}
|
|
1847
1845
|
class PersistenceUserManager {
|
|
1848
1846
|
constructor(persistence, auth, userKey) {
|
|
@@ -1851,7 +1849,7 @@ class PersistenceUserManager {
|
|
|
1851
1849
|
this.userKey = userKey;
|
|
1852
1850
|
const { config, name } = this.auth;
|
|
1853
1851
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
1854
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
1852
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
1855
1853
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
1856
1854
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
1857
1855
|
}
|
|
@@ -1882,7 +1880,7 @@ class PersistenceUserManager {
|
|
|
1882
1880
|
delete() {
|
|
1883
1881
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
1884
1882
|
}
|
|
1885
|
-
static async create(auth, persistenceHierarchy, userKey = "authUser" /* AUTH_USER */) {
|
|
1883
|
+
static async create(auth, persistenceHierarchy, userKey = "authUser" /* KeyName.AUTH_USER */) {
|
|
1886
1884
|
if (!persistenceHierarchy.length) {
|
|
1887
1885
|
return new PersistenceUserManager(_getInstance(inMemoryPersistence), auth, userKey);
|
|
1888
1886
|
}
|
|
@@ -1967,42 +1965,42 @@ class PersistenceUserManager {
|
|
|
1967
1965
|
function _getBrowserName(userAgent) {
|
|
1968
1966
|
const ua = userAgent.toLowerCase();
|
|
1969
1967
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
1970
|
-
return "Opera" /* OPERA */;
|
|
1968
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
1971
1969
|
}
|
|
1972
1970
|
else if (_isIEMobile(ua)) {
|
|
1973
1971
|
// Windows phone IEMobile browser.
|
|
1974
|
-
return "IEMobile" /* IEMOBILE */;
|
|
1972
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
1975
1973
|
}
|
|
1976
1974
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
1977
|
-
return "IE" /* IE */;
|
|
1975
|
+
return "IE" /* BrowserName.IE */;
|
|
1978
1976
|
}
|
|
1979
1977
|
else if (ua.includes('edge/')) {
|
|
1980
|
-
return "Edge" /* EDGE */;
|
|
1978
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
1981
1979
|
}
|
|
1982
1980
|
else if (_isFirefox(ua)) {
|
|
1983
|
-
return "Firefox" /* FIREFOX */;
|
|
1981
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
1984
1982
|
}
|
|
1985
1983
|
else if (ua.includes('silk/')) {
|
|
1986
|
-
return "Silk" /* SILK */;
|
|
1984
|
+
return "Silk" /* BrowserName.SILK */;
|
|
1987
1985
|
}
|
|
1988
1986
|
else if (_isBlackBerry(ua)) {
|
|
1989
1987
|
// Blackberry browser.
|
|
1990
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
1988
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
1991
1989
|
}
|
|
1992
1990
|
else if (_isWebOS(ua)) {
|
|
1993
1991
|
// WebOS default browser.
|
|
1994
|
-
return "Webos" /* WEBOS */;
|
|
1992
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
1995
1993
|
}
|
|
1996
1994
|
else if (_isSafari(ua)) {
|
|
1997
|
-
return "Safari" /* SAFARI */;
|
|
1995
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
1998
1996
|
}
|
|
1999
1997
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
2000
1998
|
!ua.includes('edge/')) {
|
|
2001
|
-
return "Chrome" /* CHROME */;
|
|
1999
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
2002
2000
|
}
|
|
2003
2001
|
else if (_isAndroid(ua)) {
|
|
2004
2002
|
// Android stock browser.
|
|
2005
|
-
return "Android" /* ANDROID */;
|
|
2003
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
2006
2004
|
}
|
|
2007
2005
|
else {
|
|
2008
2006
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -2012,7 +2010,7 @@ function _getBrowserName(userAgent) {
|
|
|
2012
2010
|
return matches[1];
|
|
2013
2011
|
}
|
|
2014
2012
|
}
|
|
2015
|
-
return "Other" /* OTHER */;
|
|
2013
|
+
return "Other" /* BrowserName.OTHER */;
|
|
2016
2014
|
}
|
|
2017
2015
|
function _isFirefox(ua = getUA()) {
|
|
2018
2016
|
return /firefox\//i.test(ua);
|
|
@@ -2092,11 +2090,11 @@ function _isIframe() {
|
|
|
2092
2090
|
function _getClientVersion(clientPlatform, frameworks = []) {
|
|
2093
2091
|
let reportedPlatform;
|
|
2094
2092
|
switch (clientPlatform) {
|
|
2095
|
-
case "Browser" /* BROWSER */:
|
|
2093
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
2096
2094
|
// In a browser environment, report the browser name.
|
|
2097
2095
|
reportedPlatform = _getBrowserName(getUA());
|
|
2098
2096
|
break;
|
|
2099
|
-
case "Worker" /* WORKER */:
|
|
2097
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
2100
2098
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
2101
2099
|
// worker from a browser.
|
|
2102
2100
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
@@ -2108,7 +2106,7 @@ function _getClientVersion(clientPlatform, frameworks = []) {
|
|
|
2108
2106
|
const reportedFrameworks = frameworks.length
|
|
2109
2107
|
? frameworks.join(',')
|
|
2110
2108
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
2111
|
-
return `${reportedPlatform}/${"JsCore" /* CORE */}/${SDK_VERSION}/${reportedFrameworks}`;
|
|
2109
|
+
return `${reportedPlatform}/${"JsCore" /* ClientImplementation.CORE */}/${SDK_VERSION}/${reportedFrameworks}`;
|
|
2112
2110
|
}
|
|
2113
2111
|
|
|
2114
2112
|
/**
|
|
@@ -2158,7 +2156,6 @@ class AuthMiddlewareQueue {
|
|
|
2158
2156
|
};
|
|
2159
2157
|
}
|
|
2160
2158
|
async runMiddleware(nextUser) {
|
|
2161
|
-
var _a;
|
|
2162
2159
|
if (this.auth.currentUser === nextUser) {
|
|
2163
2160
|
return;
|
|
2164
2161
|
}
|
|
@@ -2186,8 +2183,8 @@ class AuthMiddlewareQueue {
|
|
|
2186
2183
|
/* swallow error */
|
|
2187
2184
|
}
|
|
2188
2185
|
}
|
|
2189
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2190
|
-
originalMessage:
|
|
2186
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2187
|
+
originalMessage: e === null || e === void 0 ? void 0 : e.message
|
|
2191
2188
|
});
|
|
2192
2189
|
}
|
|
2193
2190
|
}
|
|
@@ -2347,7 +2344,7 @@ class AuthImpl {
|
|
|
2347
2344
|
return this.directlySetCurrentUser(null);
|
|
2348
2345
|
}
|
|
2349
2346
|
}
|
|
2350
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2347
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2351
2348
|
await this.getOrInitRedirectPersistenceManager();
|
|
2352
2349
|
// If the redirect user's event ID matches the current user's event ID,
|
|
2353
2350
|
// DO NOT reload the current user, otherwise they'll be cleared from storage.
|
|
@@ -2388,13 +2385,12 @@ class AuthImpl {
|
|
|
2388
2385
|
return result;
|
|
2389
2386
|
}
|
|
2390
2387
|
async reloadAndSetCurrentUserOrClear(user) {
|
|
2391
|
-
var _a;
|
|
2392
2388
|
try {
|
|
2393
2389
|
await _reloadWithoutSaving(user);
|
|
2394
2390
|
}
|
|
2395
2391
|
catch (e) {
|
|
2396
|
-
if ((
|
|
2397
|
-
`auth/${"network-request-failed" /* NETWORK_REQUEST_FAILED */}`) {
|
|
2392
|
+
if ((e === null || e === void 0 ? void 0 : e.code) !==
|
|
2393
|
+
`auth/${"network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */}`) {
|
|
2398
2394
|
// Something's wrong with the user's token. Log them out and remove
|
|
2399
2395
|
// them from storage
|
|
2400
2396
|
return this.directlySetCurrentUser(null);
|
|
@@ -2415,7 +2411,7 @@ class AuthImpl {
|
|
|
2415
2411
|
? getModularInstance(userExtern)
|
|
2416
2412
|
: null;
|
|
2417
2413
|
if (user) {
|
|
2418
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2414
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2419
2415
|
}
|
|
2420
2416
|
return this._updateCurrentUser(user && user._clone(this));
|
|
2421
2417
|
}
|
|
@@ -2424,7 +2420,7 @@ class AuthImpl {
|
|
|
2424
2420
|
return;
|
|
2425
2421
|
}
|
|
2426
2422
|
if (user) {
|
|
2427
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2423
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2428
2424
|
}
|
|
2429
2425
|
if (!skipBeforeStateCallbacks) {
|
|
2430
2426
|
await this.beforeStateQueue.runMiddleware(user);
|
|
@@ -2484,8 +2480,8 @@ class AuthImpl {
|
|
|
2484
2480
|
if (!this.redirectPersistenceManager) {
|
|
2485
2481
|
const resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
2486
2482
|
this._popupRedirectResolver;
|
|
2487
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2488
|
-
this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */);
|
|
2483
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2484
|
+
this.redirectPersistenceManager = await PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */);
|
|
2489
2485
|
this.redirectUser =
|
|
2490
2486
|
await this.redirectPersistenceManager.getCurrentUser();
|
|
2491
2487
|
}
|
|
@@ -2558,7 +2554,7 @@ class AuthImpl {
|
|
|
2558
2554
|
const promise = this._isInitialized
|
|
2559
2555
|
? Promise.resolve()
|
|
2560
2556
|
: this._initializationPromise;
|
|
2561
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
2557
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2562
2558
|
// The callback needs to be called asynchronously per the spec.
|
|
2563
2559
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2564
2560
|
promise.then(() => cb(this.currentUser));
|
|
@@ -2596,7 +2592,7 @@ class AuthImpl {
|
|
|
2596
2592
|
return this.operations;
|
|
2597
2593
|
}
|
|
2598
2594
|
get assertedPersistence() {
|
|
2599
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
2595
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2600
2596
|
return this.persistenceManager;
|
|
2601
2597
|
}
|
|
2602
2598
|
_logFramework(framework) {
|
|
@@ -2616,10 +2612,10 @@ class AuthImpl {
|
|
|
2616
2612
|
var _a;
|
|
2617
2613
|
// Additional headers on every request
|
|
2618
2614
|
const headers = {
|
|
2619
|
-
["X-Client-Version" /* X_CLIENT_VERSION */]: this.clientVersion
|
|
2615
|
+
["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */]: this.clientVersion
|
|
2620
2616
|
};
|
|
2621
2617
|
if (this.app.options.appId) {
|
|
2622
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
2618
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
2623
2619
|
}
|
|
2624
2620
|
// If the heartbeat service exists, add the heartbeat string
|
|
2625
2621
|
const heartbeatsHeader = await ((_a = this.heartbeatServiceProvider
|
|
@@ -2627,7 +2623,7 @@ class AuthImpl {
|
|
|
2627
2623
|
optional: true
|
|
2628
2624
|
})) === null || _a === void 0 ? void 0 : _a.getHeartbeatsHeader());
|
|
2629
2625
|
if (heartbeatsHeader) {
|
|
2630
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
2626
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
2631
2627
|
}
|
|
2632
2628
|
return headers;
|
|
2633
2629
|
}
|
|
@@ -2649,7 +2645,7 @@ class Subscription {
|
|
|
2649
2645
|
this.addObserver = createSubscribe(observer => (this.observer = observer));
|
|
2650
2646
|
}
|
|
2651
2647
|
get next() {
|
|
2652
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2648
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2653
2649
|
return this.observer.next.bind(this.observer);
|
|
2654
2650
|
}
|
|
2655
2651
|
}
|
|
@@ -2678,8 +2674,8 @@ class Subscription {
|
|
|
2678
2674
|
*/
|
|
2679
2675
|
function connectAuthEmulator(auth, url, options) {
|
|
2680
2676
|
const authInternal = _castAuth(auth);
|
|
2681
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
2682
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
2677
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
2678
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
2683
2679
|
const disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
2684
2680
|
const protocol = extractProtocol(url);
|
|
2685
2681
|
const { host, port } = extractHostAndPort(url);
|
|
@@ -2847,13 +2843,13 @@ class AuthCredential {
|
|
|
2847
2843
|
* limitations under the License.
|
|
2848
2844
|
*/
|
|
2849
2845
|
async function resetPassword(auth, request) {
|
|
2850
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2846
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2851
2847
|
}
|
|
2852
2848
|
async function updateEmailPassword(auth, request) {
|
|
2853
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
2849
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
2854
2850
|
}
|
|
2855
2851
|
async function applyActionCode$1(auth, request) {
|
|
2856
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));
|
|
2852
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request));
|
|
2857
2853
|
}
|
|
2858
2854
|
|
|
2859
2855
|
/**
|
|
@@ -2873,10 +2869,10 @@ async function applyActionCode$1(auth, request) {
|
|
|
2873
2869
|
* limitations under the License.
|
|
2874
2870
|
*/
|
|
2875
2871
|
async function signInWithPassword(auth, request) {
|
|
2876
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2872
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request));
|
|
2877
2873
|
}
|
|
2878
2874
|
async function sendOobCode(auth, request) {
|
|
2879
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request));
|
|
2875
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request));
|
|
2880
2876
|
}
|
|
2881
2877
|
async function sendEmailVerification$1(auth, request) {
|
|
2882
2878
|
return sendOobCode(auth, request);
|
|
@@ -2908,10 +2904,10 @@ async function verifyAndChangeEmail(auth, request) {
|
|
|
2908
2904
|
* limitations under the License.
|
|
2909
2905
|
*/
|
|
2910
2906
|
async function signInWithEmailLink$1(auth, request) {
|
|
2911
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2907
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2912
2908
|
}
|
|
2913
2909
|
async function signInWithEmailLinkForLinking(auth, request) {
|
|
2914
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2910
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request));
|
|
2915
2911
|
}
|
|
2916
2912
|
|
|
2917
2913
|
/**
|
|
@@ -2949,18 +2945,18 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
2949
2945
|
_password, signInMethod,
|
|
2950
2946
|
/** @internal */
|
|
2951
2947
|
_tenantId = null) {
|
|
2952
|
-
super("password" /* PASSWORD */, signInMethod);
|
|
2948
|
+
super("password" /* ProviderId.PASSWORD */, signInMethod);
|
|
2953
2949
|
this._email = _email;
|
|
2954
2950
|
this._password = _password;
|
|
2955
2951
|
this._tenantId = _tenantId;
|
|
2956
2952
|
}
|
|
2957
2953
|
/** @internal */
|
|
2958
2954
|
static _fromEmailAndPassword(email, password) {
|
|
2959
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
2955
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
2960
2956
|
}
|
|
2961
2957
|
/** @internal */
|
|
2962
2958
|
static _fromEmailAndCode(email, oobCode, tenantId = null) {
|
|
2963
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
2959
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
2964
2960
|
}
|
|
2965
2961
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
2966
2962
|
toJSON() {
|
|
@@ -2982,10 +2978,10 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
2982
2978
|
static fromJSON(json) {
|
|
2983
2979
|
const obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
2984
2980
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
2985
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
2981
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
2986
2982
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
2987
2983
|
}
|
|
2988
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
2984
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
2989
2985
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
2990
2986
|
}
|
|
2991
2987
|
}
|
|
@@ -2994,39 +2990,39 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
2994
2990
|
/** @internal */
|
|
2995
2991
|
async _getIdTokenResponse(auth) {
|
|
2996
2992
|
switch (this.signInMethod) {
|
|
2997
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
2993
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
2998
2994
|
return signInWithPassword(auth, {
|
|
2999
2995
|
returnSecureToken: true,
|
|
3000
2996
|
email: this._email,
|
|
3001
2997
|
password: this._password
|
|
3002
2998
|
});
|
|
3003
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
2999
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3004
3000
|
return signInWithEmailLink$1(auth, {
|
|
3005
3001
|
email: this._email,
|
|
3006
3002
|
oobCode: this._password
|
|
3007
3003
|
});
|
|
3008
3004
|
default:
|
|
3009
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3005
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3010
3006
|
}
|
|
3011
3007
|
}
|
|
3012
3008
|
/** @internal */
|
|
3013
3009
|
async _linkToIdToken(auth, idToken) {
|
|
3014
3010
|
switch (this.signInMethod) {
|
|
3015
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3011
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3016
3012
|
return updateEmailPassword(auth, {
|
|
3017
3013
|
idToken,
|
|
3018
3014
|
returnSecureToken: true,
|
|
3019
3015
|
email: this._email,
|
|
3020
3016
|
password: this._password
|
|
3021
3017
|
});
|
|
3022
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3018
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3023
3019
|
return signInWithEmailLinkForLinking(auth, {
|
|
3024
3020
|
idToken,
|
|
3025
3021
|
email: this._email,
|
|
3026
3022
|
oobCode: this._password
|
|
3027
3023
|
});
|
|
3028
3024
|
default:
|
|
3029
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3025
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3030
3026
|
}
|
|
3031
3027
|
}
|
|
3032
3028
|
/** @internal */
|
|
@@ -3052,7 +3048,7 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3052
3048
|
* limitations under the License.
|
|
3053
3049
|
*/
|
|
3054
3050
|
async function signInWithIdp(auth, request) {
|
|
3055
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));
|
|
3051
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request));
|
|
3056
3052
|
}
|
|
3057
3053
|
|
|
3058
3054
|
/**
|
|
@@ -3110,7 +3106,7 @@ class OAuthCredential extends AuthCredential {
|
|
|
3110
3106
|
cred.secret = params.oauthTokenSecret;
|
|
3111
3107
|
}
|
|
3112
3108
|
else {
|
|
3113
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
3109
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3114
3110
|
}
|
|
3115
3111
|
return cred;
|
|
3116
3112
|
}
|
|
@@ -3212,21 +3208,21 @@ class OAuthCredential extends AuthCredential {
|
|
|
3212
3208
|
* limitations under the License.
|
|
3213
3209
|
*/
|
|
3214
3210
|
async function signInWithPhoneNumber$1(auth, request) {
|
|
3215
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3211
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3216
3212
|
}
|
|
3217
3213
|
async function linkWithPhoneNumber$1(auth, request) {
|
|
3218
|
-
const response = await _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3214
|
+
const response = await _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request));
|
|
3219
3215
|
if (response.temporaryProof) {
|
|
3220
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
3216
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
3221
3217
|
}
|
|
3222
3218
|
return response;
|
|
3223
3219
|
}
|
|
3224
3220
|
const VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = {
|
|
3225
|
-
["USER_NOT_FOUND" /* USER_NOT_FOUND */]: "user-not-found" /* USER_DELETED */
|
|
3221
|
+
["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */]: "user-not-found" /* AuthErrorCode.USER_DELETED */
|
|
3226
3222
|
};
|
|
3227
3223
|
async function verifyPhoneNumberForExisting(auth, request) {
|
|
3228
3224
|
const apiRequest = Object.assign(Object.assign({}, request), { operation: 'REAUTH' });
|
|
3229
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_);
|
|
3225
|
+
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_);
|
|
3230
3226
|
}
|
|
3231
3227
|
|
|
3232
3228
|
/**
|
|
@@ -3252,7 +3248,7 @@ async function verifyPhoneNumberForExisting(auth, request) {
|
|
|
3252
3248
|
*/
|
|
3253
3249
|
class PhoneAuthCredential extends AuthCredential {
|
|
3254
3250
|
constructor(params) {
|
|
3255
|
-
super("phone" /* PHONE */, "phone" /* PHONE */);
|
|
3251
|
+
super("phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */);
|
|
3256
3252
|
this.params = params;
|
|
3257
3253
|
}
|
|
3258
3254
|
/** @internal */
|
|
@@ -3350,17 +3346,17 @@ class PhoneAuthCredential extends AuthCredential {
|
|
|
3350
3346
|
function parseMode(mode) {
|
|
3351
3347
|
switch (mode) {
|
|
3352
3348
|
case 'recoverEmail':
|
|
3353
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
3349
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
3354
3350
|
case 'resetPassword':
|
|
3355
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
3351
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
3356
3352
|
case 'signIn':
|
|
3357
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
3353
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
3358
3354
|
case 'verifyEmail':
|
|
3359
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
3355
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
3360
3356
|
case 'verifyAndChangeEmail':
|
|
3361
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
3357
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
3362
3358
|
case 'revertSecondFactorAddition':
|
|
3363
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
3359
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
3364
3360
|
default:
|
|
3365
3361
|
return null;
|
|
3366
3362
|
}
|
|
@@ -3399,17 +3395,17 @@ class ActionCodeURL {
|
|
|
3399
3395
|
constructor(actionLink) {
|
|
3400
3396
|
var _a, _b, _c, _d, _e, _f;
|
|
3401
3397
|
const searchParams = querystringDecode(extractQuerystring(actionLink));
|
|
3402
|
-
const apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3403
|
-
const code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3404
|
-
const operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3398
|
+
const apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3399
|
+
const code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3400
|
+
const operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3405
3401
|
// Validate API key, code and mode.
|
|
3406
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
3402
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3407
3403
|
this.apiKey = apiKey;
|
|
3408
3404
|
this.operation = operation;
|
|
3409
3405
|
this.code = code;
|
|
3410
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3411
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3412
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3406
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3407
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3408
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3413
3409
|
}
|
|
3414
3410
|
/**
|
|
3415
3411
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -3513,22 +3509,22 @@ class EmailAuthProvider {
|
|
|
3513
3509
|
*/
|
|
3514
3510
|
static credentialWithLink(email, emailLink) {
|
|
3515
3511
|
const actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
3516
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
3512
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3517
3513
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
3518
3514
|
}
|
|
3519
3515
|
}
|
|
3520
3516
|
/**
|
|
3521
3517
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
3522
3518
|
*/
|
|
3523
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
3519
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
3524
3520
|
/**
|
|
3525
3521
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
3526
3522
|
*/
|
|
3527
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
3523
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
3528
3524
|
/**
|
|
3529
3525
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
3530
3526
|
*/
|
|
3531
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
3527
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
3532
3528
|
|
|
3533
3529
|
/**
|
|
3534
3530
|
* @license
|
|
@@ -3690,7 +3686,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3690
3686
|
*/
|
|
3691
3687
|
static credentialFromJSON(json) {
|
|
3692
3688
|
const obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
3693
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
3689
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3694
3690
|
return OAuthCredential._fromParams(obj);
|
|
3695
3691
|
}
|
|
3696
3692
|
/**
|
|
@@ -3719,7 +3715,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3719
3715
|
}
|
|
3720
3716
|
/** An internal credential method that accepts more permissive options */
|
|
3721
3717
|
_credential(params) {
|
|
3722
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
3718
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3723
3719
|
// For OAuthCredential, sign in method is same as providerId.
|
|
3724
3720
|
return OAuthCredential._fromParams(Object.assign(Object.assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
3725
3721
|
}
|
|
@@ -3825,7 +3821,7 @@ class OAuthProvider extends BaseOAuthProvider {
|
|
|
3825
3821
|
*/
|
|
3826
3822
|
class FacebookAuthProvider extends BaseOAuthProvider {
|
|
3827
3823
|
constructor() {
|
|
3828
|
-
super("facebook.com" /* FACEBOOK */);
|
|
3824
|
+
super("facebook.com" /* ProviderId.FACEBOOK */);
|
|
3829
3825
|
}
|
|
3830
3826
|
/**
|
|
3831
3827
|
* Creates a credential for Facebook.
|
|
@@ -3879,9 +3875,9 @@ class FacebookAuthProvider extends BaseOAuthProvider {
|
|
|
3879
3875
|
}
|
|
3880
3876
|
}
|
|
3881
3877
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
3882
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
3878
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
3883
3879
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
3884
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
3880
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
3885
3881
|
|
|
3886
3882
|
/**
|
|
3887
3883
|
* @license
|
|
@@ -3942,7 +3938,7 @@ FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
|
3942
3938
|
*/
|
|
3943
3939
|
class GoogleAuthProvider extends BaseOAuthProvider {
|
|
3944
3940
|
constructor() {
|
|
3945
|
-
super("google.com" /* GOOGLE */);
|
|
3941
|
+
super("google.com" /* ProviderId.GOOGLE */);
|
|
3946
3942
|
this.addScope('profile');
|
|
3947
3943
|
}
|
|
3948
3944
|
/**
|
|
@@ -4001,9 +3997,9 @@ class GoogleAuthProvider extends BaseOAuthProvider {
|
|
|
4001
3997
|
}
|
|
4002
3998
|
}
|
|
4003
3999
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
4004
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
4000
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
4005
4001
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
4006
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
4002
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
4007
4003
|
|
|
4008
4004
|
/**
|
|
4009
4005
|
* @license
|
|
@@ -4065,7 +4061,7 @@ GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
|
4065
4061
|
*/
|
|
4066
4062
|
class GithubAuthProvider extends BaseOAuthProvider {
|
|
4067
4063
|
constructor() {
|
|
4068
|
-
super("github.com" /* GITHUB */);
|
|
4064
|
+
super("github.com" /* ProviderId.GITHUB */);
|
|
4069
4065
|
}
|
|
4070
4066
|
/**
|
|
4071
4067
|
* Creates a credential for Github.
|
|
@@ -4112,9 +4108,9 @@ class GithubAuthProvider extends BaseOAuthProvider {
|
|
|
4112
4108
|
}
|
|
4113
4109
|
}
|
|
4114
4110
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
4115
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
4111
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
4116
4112
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
4117
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
4113
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
4118
4114
|
|
|
4119
4115
|
/**
|
|
4120
4116
|
* @license
|
|
@@ -4232,7 +4228,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4232
4228
|
* @param providerId - SAML provider ID.
|
|
4233
4229
|
*/
|
|
4234
4230
|
constructor(providerId) {
|
|
4235
|
-
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* ARGUMENT_ERROR */);
|
|
4231
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4236
4232
|
super(providerId);
|
|
4237
4233
|
}
|
|
4238
4234
|
/**
|
|
@@ -4269,7 +4265,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4269
4265
|
*/
|
|
4270
4266
|
static credentialFromJSON(json) {
|
|
4271
4267
|
const credential = SAMLAuthCredential.fromJSON(json);
|
|
4272
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
4268
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4273
4269
|
return credential;
|
|
4274
4270
|
}
|
|
4275
4271
|
static samlCredentialFromTaggedObject({ _tokenResponse: tokenResponse }) {
|
|
@@ -4346,7 +4342,7 @@ class SAMLAuthProvider extends FederatedAuthProvider {
|
|
|
4346
4342
|
*/
|
|
4347
4343
|
class TwitterAuthProvider extends BaseOAuthProvider {
|
|
4348
4344
|
constructor() {
|
|
4349
|
-
super("twitter.com" /* TWITTER */);
|
|
4345
|
+
super("twitter.com" /* ProviderId.TWITTER */);
|
|
4350
4346
|
}
|
|
4351
4347
|
/**
|
|
4352
4348
|
* Creates a credential for Twitter.
|
|
@@ -4396,9 +4392,9 @@ class TwitterAuthProvider extends BaseOAuthProvider {
|
|
|
4396
4392
|
}
|
|
4397
4393
|
}
|
|
4398
4394
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
4399
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
4395
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
4400
4396
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
4401
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
4397
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
4402
4398
|
|
|
4403
4399
|
/**
|
|
4404
4400
|
* @license
|
|
@@ -4417,7 +4413,7 @@ TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
|
4417
4413
|
* limitations under the License.
|
|
4418
4414
|
*/
|
|
4419
4415
|
async function signUp(auth, request) {
|
|
4420
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request));
|
|
4416
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request));
|
|
4421
4417
|
}
|
|
4422
4418
|
|
|
4423
4419
|
/**
|
|
@@ -4470,7 +4466,7 @@ function providerIdForResponse(response) {
|
|
|
4470
4466
|
return response.providerId;
|
|
4471
4467
|
}
|
|
4472
4468
|
if ('phoneNumber' in response) {
|
|
4473
|
-
return "phone" /* PHONE */;
|
|
4469
|
+
return "phone" /* ProviderId.PHONE */;
|
|
4474
4470
|
}
|
|
4475
4471
|
return null;
|
|
4476
4472
|
}
|
|
@@ -4511,13 +4507,13 @@ async function signInAnonymously(auth) {
|
|
|
4511
4507
|
return new UserCredentialImpl({
|
|
4512
4508
|
user: authInternal.currentUser,
|
|
4513
4509
|
providerId: null,
|
|
4514
|
-
operationType: "signIn" /* SIGN_IN */
|
|
4510
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
4515
4511
|
});
|
|
4516
4512
|
}
|
|
4517
4513
|
const response = await signUp(authInternal, {
|
|
4518
4514
|
returnSecureToken: true
|
|
4519
4515
|
});
|
|
4520
|
-
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true);
|
|
4516
|
+
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true);
|
|
4521
4517
|
await authInternal._updateCurrentUser(userCredential.user);
|
|
4522
4518
|
return userCredential;
|
|
4523
4519
|
}
|
|
@@ -4558,11 +4554,11 @@ class MultiFactorError extends FirebaseError {
|
|
|
4558
4554
|
}
|
|
4559
4555
|
}
|
|
4560
4556
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
4561
|
-
const idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
4557
|
+
const idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
4562
4558
|
? credential._getReauthenticationResolver(auth)
|
|
4563
4559
|
: credential._getIdTokenResponse(auth);
|
|
4564
4560
|
return idTokenProvider.catch(error => {
|
|
4565
|
-
if (error.code === `auth/${"multi-factor-auth-required" /* MFA_REQUIRED */}`) {
|
|
4561
|
+
if (error.code === `auth/${"multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */}`) {
|
|
4566
4562
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
4567
4563
|
}
|
|
4568
4564
|
throw error;
|
|
@@ -4627,7 +4623,7 @@ async function unlink(user, providerId) {
|
|
|
4627
4623
|
});
|
|
4628
4624
|
const providersLeft = providerDataAsNames(providerUserInfo || []);
|
|
4629
4625
|
userInternal.providerData = userInternal.providerData.filter(pd => providersLeft.has(pd.providerId));
|
|
4630
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
4626
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
4631
4627
|
userInternal.phoneNumber = null;
|
|
4632
4628
|
}
|
|
4633
4629
|
await userInternal.auth._persistUserIfCurrent(userInternal);
|
|
@@ -4635,14 +4631,14 @@ async function unlink(user, providerId) {
|
|
|
4635
4631
|
}
|
|
4636
4632
|
async function _link(user, credential, bypassAuthState = false) {
|
|
4637
4633
|
const response = await _logoutIfInvalidated(user, credential._linkToIdToken(user.auth, await user.getIdToken()), bypassAuthState);
|
|
4638
|
-
return UserCredentialImpl._forOperation(user, "link" /* LINK */, response);
|
|
4634
|
+
return UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response);
|
|
4639
4635
|
}
|
|
4640
4636
|
async function _assertLinkedStatus(expected, user, provider) {
|
|
4641
4637
|
await _reloadWithoutSaving(user);
|
|
4642
4638
|
const providerIds = providerDataAsNames(user.providerData);
|
|
4643
4639
|
const code = expected === false
|
|
4644
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
4645
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
4640
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
4641
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
4646
4642
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
4647
4643
|
}
|
|
4648
4644
|
|
|
@@ -4663,22 +4659,21 @@ async function _assertLinkedStatus(expected, user, provider) {
|
|
|
4663
4659
|
* limitations under the License.
|
|
4664
4660
|
*/
|
|
4665
4661
|
async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
4666
|
-
var _a;
|
|
4667
4662
|
const { auth } = user;
|
|
4668
|
-
const operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
4663
|
+
const operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
4669
4664
|
try {
|
|
4670
4665
|
const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);
|
|
4671
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4666
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4672
4667
|
const parsed = _parseToken(response.idToken);
|
|
4673
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4668
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4674
4669
|
const { sub: localId } = parsed;
|
|
4675
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
4670
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
4676
4671
|
return UserCredentialImpl._forOperation(user, operationType, response);
|
|
4677
4672
|
}
|
|
4678
4673
|
catch (e) {
|
|
4679
4674
|
// Convert user deleted error into user mismatch
|
|
4680
|
-
if ((
|
|
4681
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
4675
|
+
if ((e === null || e === void 0 ? void 0 : e.code) === `auth/${"user-not-found" /* AuthErrorCode.USER_DELETED */}`) {
|
|
4676
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
4682
4677
|
}
|
|
4683
4678
|
throw e;
|
|
4684
4679
|
}
|
|
@@ -4701,7 +4696,7 @@ async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
|
4701
4696
|
* limitations under the License.
|
|
4702
4697
|
*/
|
|
4703
4698
|
async function _signInWithCredential(auth, credential, bypassAuthState = false) {
|
|
4704
|
-
const operationType = "signIn" /* SIGN_IN */;
|
|
4699
|
+
const operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
4705
4700
|
const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);
|
|
4706
4701
|
const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);
|
|
4707
4702
|
if (!bypassAuthState) {
|
|
@@ -4772,7 +4767,7 @@ async function reauthenticateWithCredential(user, credential) {
|
|
|
4772
4767
|
* limitations under the License.
|
|
4773
4768
|
*/
|
|
4774
4769
|
async function signInWithCustomToken$1(auth, request) {
|
|
4775
|
-
return _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request));
|
|
4770
|
+
return _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request));
|
|
4776
4771
|
}
|
|
4777
4772
|
|
|
4778
4773
|
/**
|
|
@@ -4813,7 +4808,7 @@ async function signInWithCustomToken(auth, customToken) {
|
|
|
4813
4808
|
token: customToken,
|
|
4814
4809
|
returnSecureToken: true
|
|
4815
4810
|
});
|
|
4816
|
-
const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response);
|
|
4811
|
+
const cred = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response);
|
|
4817
4812
|
await authInternal._updateCurrentUser(cred.user);
|
|
4818
4813
|
return cred;
|
|
4819
4814
|
}
|
|
@@ -4845,12 +4840,12 @@ class MultiFactorInfoImpl {
|
|
|
4845
4840
|
if ('phoneInfo' in enrollment) {
|
|
4846
4841
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
4847
4842
|
}
|
|
4848
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4843
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4849
4844
|
}
|
|
4850
4845
|
}
|
|
4851
4846
|
class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl {
|
|
4852
4847
|
constructor(response) {
|
|
4853
|
-
super("phone" /* PHONE */, response);
|
|
4848
|
+
super("phone" /* FactorId.PHONE */, response);
|
|
4854
4849
|
this.phoneNumber = response.phoneInfo;
|
|
4855
4850
|
}
|
|
4856
4851
|
static _fromServerResponse(_auth, enrollment) {
|
|
@@ -4876,18 +4871,18 @@ class PhoneMultiFactorInfoImpl extends MultiFactorInfoImpl {
|
|
|
4876
4871
|
*/
|
|
4877
4872
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
4878
4873
|
var _a;
|
|
4879
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
4874
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
4880
4875
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
4881
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
4876
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
4882
4877
|
request.continueUrl = actionCodeSettings.url;
|
|
4883
4878
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
4884
4879
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
4885
4880
|
if (actionCodeSettings.iOS) {
|
|
4886
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
4881
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
4887
4882
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
4888
4883
|
}
|
|
4889
4884
|
if (actionCodeSettings.android) {
|
|
4890
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
4885
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
4891
4886
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
4892
4887
|
request.androidMinimumVersionCode =
|
|
4893
4888
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -4946,7 +4941,7 @@ function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
|
4946
4941
|
async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
4947
4942
|
const authModular = getModularInstance(auth);
|
|
4948
4943
|
const request = {
|
|
4949
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
4944
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
4950
4945
|
email
|
|
4951
4946
|
};
|
|
4952
4947
|
if (actionCodeSettings) {
|
|
@@ -5001,18 +4996,18 @@ async function checkActionCode(auth, oobCode) {
|
|
|
5001
4996
|
// Multi-factor info could not be empty if the request type is
|
|
5002
4997
|
// REVERT_SECOND_FACTOR_ADDITION.
|
|
5003
4998
|
const operation = response.requestType;
|
|
5004
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
4999
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5005
5000
|
switch (operation) {
|
|
5006
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
5001
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
5007
5002
|
break;
|
|
5008
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
5009
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5003
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
5004
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5010
5005
|
break;
|
|
5011
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
5012
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5006
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
5007
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5013
5008
|
// fall through
|
|
5014
5009
|
default:
|
|
5015
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5010
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5016
5011
|
}
|
|
5017
5012
|
// The multi-factor info for revert second factor addition
|
|
5018
5013
|
let multiFactorInfo = null;
|
|
@@ -5021,10 +5016,10 @@ async function checkActionCode(auth, oobCode) {
|
|
|
5021
5016
|
}
|
|
5022
5017
|
return {
|
|
5023
5018
|
data: {
|
|
5024
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5019
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5025
5020
|
? response.newEmail
|
|
5026
5021
|
: response.email) || null,
|
|
5027
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5022
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5028
5023
|
? response.email
|
|
5029
5024
|
: response.newEmail) || null,
|
|
5030
5025
|
multiFactorInfo
|
|
@@ -5071,7 +5066,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5071
5066
|
email,
|
|
5072
5067
|
password
|
|
5073
5068
|
});
|
|
5074
|
-
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response);
|
|
5069
|
+
const userCredential = await UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response);
|
|
5075
5070
|
await authInternal._updateCurrentUser(userCredential.user);
|
|
5076
5071
|
return userCredential;
|
|
5077
5072
|
}
|
|
@@ -5152,10 +5147,10 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
5152
5147
|
async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
5153
5148
|
const authModular = getModularInstance(auth);
|
|
5154
5149
|
const request = {
|
|
5155
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
5150
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
5156
5151
|
email
|
|
5157
5152
|
};
|
|
5158
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5153
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5159
5154
|
if (actionCodeSettings) {
|
|
5160
5155
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
5161
5156
|
}
|
|
@@ -5171,7 +5166,7 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5171
5166
|
*/
|
|
5172
5167
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
5173
5168
|
const actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
5174
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
5169
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
5175
5170
|
}
|
|
5176
5171
|
/**
|
|
5177
5172
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -5215,7 +5210,7 @@ async function signInWithEmailLink(auth, email, emailLink) {
|
|
|
5215
5210
|
const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
5216
5211
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
5217
5212
|
// instance.
|
|
5218
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
5213
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
5219
5214
|
return signInWithCredential(authModular, credential);
|
|
5220
5215
|
}
|
|
5221
5216
|
|
|
@@ -5236,7 +5231,7 @@ async function signInWithEmailLink(auth, email, emailLink) {
|
|
|
5236
5231
|
* limitations under the License.
|
|
5237
5232
|
*/
|
|
5238
5233
|
async function createAuthUri(auth, request) {
|
|
5239
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request));
|
|
5234
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request));
|
|
5240
5235
|
}
|
|
5241
5236
|
|
|
5242
5237
|
/**
|
|
@@ -5315,7 +5310,7 @@ async function sendEmailVerification(user, actionCodeSettings) {
|
|
|
5315
5310
|
const userInternal = getModularInstance(user);
|
|
5316
5311
|
const idToken = await user.getIdToken();
|
|
5317
5312
|
const request = {
|
|
5318
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
5313
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
5319
5314
|
idToken
|
|
5320
5315
|
};
|
|
5321
5316
|
if (actionCodeSettings) {
|
|
@@ -5364,7 +5359,7 @@ async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
5364
5359
|
const userInternal = getModularInstance(user);
|
|
5365
5360
|
const idToken = await user.getIdToken();
|
|
5366
5361
|
const request = {
|
|
5367
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
5362
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
5368
5363
|
idToken,
|
|
5369
5364
|
newEmail
|
|
5370
5365
|
};
|
|
@@ -5396,7 +5391,7 @@ async function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
5396
5391
|
* limitations under the License.
|
|
5397
5392
|
*/
|
|
5398
5393
|
async function updateProfile$1(auth, request) {
|
|
5399
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request);
|
|
5394
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request);
|
|
5400
5395
|
}
|
|
5401
5396
|
|
|
5402
5397
|
/**
|
|
@@ -5439,7 +5434,7 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
|
|
|
5439
5434
|
userInternal.displayName = response.displayName || null;
|
|
5440
5435
|
userInternal.photoURL = response.photoUrl || null;
|
|
5441
5436
|
// Update the password provider as well
|
|
5442
|
-
const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === "password" /* PASSWORD */);
|
|
5437
|
+
const passwordProvider = userInternal.providerData.find(({ providerId }) => providerId === "password" /* ProviderId.PASSWORD */);
|
|
5443
5438
|
if (passwordProvider) {
|
|
5444
5439
|
passwordProvider.displayName = userInternal.displayName;
|
|
5445
5440
|
passwordProvider.photoURL = userInternal.photoURL;
|
|
@@ -5528,12 +5523,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
5528
5523
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
5529
5524
|
: {};
|
|
5530
5525
|
const isNewUser = idTokenResponse.isNewUser ||
|
|
5531
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
5526
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
5532
5527
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
5533
5528
|
const signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];
|
|
5534
5529
|
if (signInProvider) {
|
|
5535
|
-
const filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
5536
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
5530
|
+
const filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
5531
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
5537
5532
|
? signInProvider
|
|
5538
5533
|
: null;
|
|
5539
5534
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -5544,16 +5539,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
5544
5539
|
return null;
|
|
5545
5540
|
}
|
|
5546
5541
|
switch (providerId) {
|
|
5547
|
-
case "facebook.com" /* FACEBOOK */:
|
|
5542
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
5548
5543
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
5549
|
-
case "github.com" /* GITHUB */:
|
|
5544
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
5550
5545
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
5551
|
-
case "google.com" /* GOOGLE */:
|
|
5546
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
5552
5547
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
5553
|
-
case "twitter.com" /* TWITTER */:
|
|
5548
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
5554
5549
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
5555
|
-
case "custom" /* CUSTOM */:
|
|
5556
|
-
case "anonymous" /* ANONYMOUS */:
|
|
5550
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
5551
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
5557
5552
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
5558
5553
|
default:
|
|
5559
5554
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -5574,22 +5569,22 @@ class FederatedAdditionalUserInfoWithUsername extends GenericAdditionalUserInfo
|
|
|
5574
5569
|
}
|
|
5575
5570
|
class FacebookAdditionalUserInfo extends GenericAdditionalUserInfo {
|
|
5576
5571
|
constructor(isNewUser, profile) {
|
|
5577
|
-
super(isNewUser, "facebook.com" /* FACEBOOK */, profile);
|
|
5572
|
+
super(isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile);
|
|
5578
5573
|
}
|
|
5579
5574
|
}
|
|
5580
5575
|
class GithubAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {
|
|
5581
5576
|
constructor(isNewUser, profile) {
|
|
5582
|
-
super(isNewUser, "github.com" /* GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null);
|
|
5577
|
+
super(isNewUser, "github.com" /* ProviderId.GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null);
|
|
5583
5578
|
}
|
|
5584
5579
|
}
|
|
5585
5580
|
class GoogleAdditionalUserInfo extends GenericAdditionalUserInfo {
|
|
5586
5581
|
constructor(isNewUser, profile) {
|
|
5587
|
-
super(isNewUser, "google.com" /* GOOGLE */, profile);
|
|
5582
|
+
super(isNewUser, "google.com" /* ProviderId.GOOGLE */, profile);
|
|
5588
5583
|
}
|
|
5589
5584
|
}
|
|
5590
5585
|
class TwitterAdditionalUserInfo extends FederatedAdditionalUserInfoWithUsername {
|
|
5591
5586
|
constructor(isNewUser, profile, screenName) {
|
|
5592
|
-
super(isNewUser, "twitter.com" /* TWITTER */, profile, screenName);
|
|
5587
|
+
super(isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName);
|
|
5593
5588
|
}
|
|
5594
5589
|
}
|
|
5595
5590
|
/**
|
|
@@ -5767,13 +5762,13 @@ class MultiFactorSessionImpl {
|
|
|
5767
5762
|
this.auth = auth;
|
|
5768
5763
|
}
|
|
5769
5764
|
static _fromIdtoken(idToken, auth) {
|
|
5770
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
5765
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
5771
5766
|
}
|
|
5772
5767
|
static _fromMfaPendingCredential(mfaPendingCredential) {
|
|
5773
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
5768
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
5774
5769
|
}
|
|
5775
5770
|
toJSON() {
|
|
5776
|
-
const key = this.type === "enroll" /* ENROLL */
|
|
5771
|
+
const key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
5777
5772
|
? 'idToken'
|
|
5778
5773
|
: 'pendingCredential';
|
|
5779
5774
|
return {
|
|
@@ -5823,7 +5818,7 @@ class MultiFactorResolverImpl {
|
|
|
5823
5818
|
const auth = _castAuth(authExtern);
|
|
5824
5819
|
const serverResponse = error.customData._serverResponse;
|
|
5825
5820
|
const hints = (serverResponse.mfaInfo || []).map(enrollment => MultiFactorInfoImpl._fromServerResponse(auth, enrollment));
|
|
5826
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5821
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5827
5822
|
const session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
5828
5823
|
return new MultiFactorResolverImpl(session, hints, async (assertion) => {
|
|
5829
5824
|
const mfaResponse = await assertion._process(auth, session);
|
|
@@ -5834,15 +5829,15 @@ class MultiFactorResolverImpl {
|
|
|
5834
5829
|
const idTokenResponse = Object.assign(Object.assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
5835
5830
|
// TODO: we should collapse this switch statement into UserCredentialImpl._forOperation and have it support the SIGN_IN case
|
|
5836
5831
|
switch (error.operationType) {
|
|
5837
|
-
case "signIn" /* SIGN_IN */:
|
|
5832
|
+
case "signIn" /* OperationType.SIGN_IN */:
|
|
5838
5833
|
const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse);
|
|
5839
5834
|
await auth._updateCurrentUser(userCredential.user);
|
|
5840
5835
|
return userCredential;
|
|
5841
|
-
case "reauthenticate" /* REAUTHENTICATE */:
|
|
5842
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5836
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */:
|
|
5837
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5843
5838
|
return UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse);
|
|
5844
5839
|
default:
|
|
5845
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5840
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5846
5841
|
}
|
|
5847
5842
|
});
|
|
5848
5843
|
}
|
|
@@ -5865,8 +5860,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
5865
5860
|
var _a;
|
|
5866
5861
|
const authModular = getModularInstance(auth);
|
|
5867
5862
|
const errorInternal = error;
|
|
5868
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5869
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5863
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5864
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5870
5865
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
5871
5866
|
}
|
|
5872
5867
|
|
|
@@ -5887,7 +5882,7 @@ function getMultiFactorResolver(auth, error) {
|
|
|
5887
5882
|
* limitations under the License.
|
|
5888
5883
|
*/
|
|
5889
5884
|
function withdrawMfa(auth, request) {
|
|
5890
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
5885
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
5891
5886
|
}
|
|
5892
5887
|
|
|
5893
5888
|
class MultiFactorUserImpl {
|
|
@@ -5919,7 +5914,6 @@ class MultiFactorUserImpl {
|
|
|
5919
5914
|
return this.user.reload();
|
|
5920
5915
|
}
|
|
5921
5916
|
async unenroll(infoOrUid) {
|
|
5922
|
-
var _a;
|
|
5923
5917
|
const mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
5924
5918
|
const idToken = await this.user.getIdToken();
|
|
5925
5919
|
const idTokenResponse = await _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
@@ -5937,7 +5931,7 @@ class MultiFactorUserImpl {
|
|
|
5937
5931
|
await this.user.reload();
|
|
5938
5932
|
}
|
|
5939
5933
|
catch (e) {
|
|
5940
|
-
if ((
|
|
5934
|
+
if ((e === null || e === void 0 ? void 0 : e.code) !== `auth/${"user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */}`) {
|
|
5941
5935
|
throw e;
|
|
5942
5936
|
}
|
|
5943
5937
|
}
|
|
@@ -5963,7 +5957,7 @@ function multiFactor(user) {
|
|
|
5963
5957
|
}
|
|
5964
5958
|
|
|
5965
5959
|
var name = "@firebase/auth";
|
|
5966
|
-
var version = "0.
|
|
5960
|
+
var version = "0.21.0";
|
|
5967
5961
|
|
|
5968
5962
|
/**
|
|
5969
5963
|
* @license
|
|
@@ -6006,8 +6000,7 @@ class AuthInterop {
|
|
|
6006
6000
|
return;
|
|
6007
6001
|
}
|
|
6008
6002
|
const unsubscribe = this.auth.onIdTokenChanged(user => {
|
|
6009
|
-
|
|
6010
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
6003
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
6011
6004
|
});
|
|
6012
6005
|
this.internalListeners.set(listener, unsubscribe);
|
|
6013
6006
|
this.updateProactiveRefresh();
|
|
@@ -6023,7 +6016,7 @@ class AuthInterop {
|
|
|
6023
6016
|
this.updateProactiveRefresh();
|
|
6024
6017
|
}
|
|
6025
6018
|
assertAuthConfigured() {
|
|
6026
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
6019
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
6027
6020
|
}
|
|
6028
6021
|
updateProactiveRefresh() {
|
|
6029
6022
|
if (this.internalListeners.size > 0) {
|
|
@@ -6053,13 +6046,13 @@ class AuthInterop {
|
|
|
6053
6046
|
*/
|
|
6054
6047
|
function getVersionForPlatform(clientPlatform) {
|
|
6055
6048
|
switch (clientPlatform) {
|
|
6056
|
-
case "Node" /* NODE */:
|
|
6049
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
6057
6050
|
return 'node';
|
|
6058
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
6051
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
6059
6052
|
return 'rn';
|
|
6060
|
-
case "Worker" /* WORKER */:
|
|
6053
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
6061
6054
|
return 'webworker';
|
|
6062
|
-
case "Cordova" /* CORDOVA */:
|
|
6055
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
6063
6056
|
return 'cordova';
|
|
6064
6057
|
default:
|
|
6065
6058
|
return undefined;
|
|
@@ -6067,47 +6060,47 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
6067
6060
|
}
|
|
6068
6061
|
/** @internal */
|
|
6069
6062
|
function registerAuth(clientPlatform) {
|
|
6070
|
-
_registerComponent(new Component("auth" /* AUTH */, (container, { options: deps }) => {
|
|
6063
|
+
_registerComponent(new Component("auth" /* _ComponentName.AUTH */, (container, { options: deps }) => {
|
|
6071
6064
|
const app = container.getProvider('app').getImmediate();
|
|
6072
6065
|
const heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
6073
6066
|
const { apiKey, authDomain } = app.options;
|
|
6074
6067
|
return ((app, heartbeatServiceProvider) => {
|
|
6075
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
6068
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
6076
6069
|
// Auth domain is optional if IdP sign in isn't being used
|
|
6077
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
6070
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
6078
6071
|
appName: app.name
|
|
6079
6072
|
});
|
|
6080
6073
|
const config = {
|
|
6081
6074
|
apiKey,
|
|
6082
6075
|
authDomain,
|
|
6083
6076
|
clientPlatform,
|
|
6084
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
6085
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
6086
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
6077
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
6078
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
6079
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
6087
6080
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
6088
6081
|
};
|
|
6089
6082
|
const authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
6090
6083
|
_initializeAuthInstance(authInstance, deps);
|
|
6091
6084
|
return authInstance;
|
|
6092
6085
|
})(app, heartbeatServiceProvider);
|
|
6093
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
6086
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
6094
6087
|
/**
|
|
6095
6088
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
6096
6089
|
* For why we do this, See go/firebase-next-auth-init
|
|
6097
6090
|
*/
|
|
6098
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
6091
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
6099
6092
|
/**
|
|
6100
6093
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
6101
6094
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
6102
6095
|
*/
|
|
6103
6096
|
.setInstanceCreatedCallback((container, _instanceIdentifier, _instance) => {
|
|
6104
|
-
const authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
6097
|
+
const authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
6105
6098
|
authInternalProvider.initialize();
|
|
6106
6099
|
}));
|
|
6107
|
-
_registerComponent(new Component("auth-internal" /* AUTH_INTERNAL */, container => {
|
|
6108
|
-
const auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
6100
|
+
_registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, container => {
|
|
6101
|
+
const auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
6109
6102
|
return (auth => new AuthInterop(auth))(auth);
|
|
6110
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
6103
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
6111
6104
|
registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
6112
6105
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
6113
6106
|
registerVersion(name, version, 'esm2017');
|
|
@@ -6145,7 +6138,7 @@ function getAuth(app = getApp()) {
|
|
|
6145
6138
|
}
|
|
6146
6139
|
return auth;
|
|
6147
6140
|
}
|
|
6148
|
-
registerAuth("Node" /* NODE */);
|
|
6141
|
+
registerAuth("Node" /* ClientPlatform.NODE */);
|
|
6149
6142
|
// The rest of this file contains no-ops and errors for browser-specific
|
|
6150
6143
|
// methods. We keep the browser and Node entry points the same, but features
|
|
6151
6144
|
// that only work in browsers are set to either do nothing (setPersistence) or
|
|
@@ -6153,7 +6146,7 @@ registerAuth("Node" /* NODE */);
|
|
|
6153
6146
|
// The below exports are pulled into the main entry point by a rollup alias
|
|
6154
6147
|
// plugin (overwriting the default browser imports).
|
|
6155
6148
|
/** auth/operation-not-supported-in-this-environment */
|
|
6156
|
-
const NOT_AVAILABLE_ERROR = _createError("operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
6149
|
+
const NOT_AVAILABLE_ERROR = _createError("operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
6157
6150
|
/** Reject with auth/operation-not-supported-in-this-environment */
|
|
6158
6151
|
async function fail() {
|
|
6159
6152
|
throw NOT_AVAILABLE_ERROR;
|
|
@@ -6195,4 +6188,4 @@ class PhoneMultiFactorGenerator {
|
|
|
6195
6188
|
AuthImpl.prototype.setPersistence = async () => { };
|
|
6196
6189
|
|
|
6197
6190
|
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, BaseOAuthProvider as aA, _emulatorUrl as aB, _performApiRequest as aC, _isIOS as aD, _isAndroid as aE, _isIOS7Or8 as aF, _createError as aG, _isIframe as aH, _isMobileBrowser as aI, _isIE10 as aJ, _isSafari as aK, UserImpl as aL, AuthImpl as aM, _getClientVersion as aN, FetchProvider as aO, SAMLAuthCredential as aP, 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, _getInstance as ap, _assert as aq, _signInWithCredential as ar, _reauthenticate as as, _link as at, signInWithIdp as au, _fail as av, debugAssert as aw, _persistenceKeyName as ax, _castAuth as ay, FederatedAuthProvider 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 };
|
|
6198
|
-
//# sourceMappingURL=index-
|
|
6191
|
+
//# sourceMappingURL=index-e0bc98c8.js.map
|