@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
|
@@ -25,147 +25,147 @@ var logger = require('@firebase/logger');
|
|
|
25
25
|
function _debugErrorMap() {
|
|
26
26
|
var _a;
|
|
27
27
|
return _a = {},
|
|
28
|
-
_a["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
29
|
-
_a["argument-error" /* ARGUMENT_ERROR */] = '',
|
|
30
|
-
_a["app-not-authorized" /* APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
28
|
+
_a["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
29
|
+
_a["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */] = '',
|
|
30
|
+
_a["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
31
31
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
32
32
|
'Review your key configuration in the Google API console.',
|
|
33
|
-
_a["app-not-installed" /* APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
33
|
+
_a["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
34
34
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
35
35
|
'this device.',
|
|
36
|
-
_a["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
36
|
+
_a["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
37
37
|
'already used or the domain associated with it does not match the list ' +
|
|
38
38
|
'of whitelisted domains.',
|
|
39
|
-
_a["code-expired" /* CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
39
|
+
_a["code-expired" /* AuthErrorCode.CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
40
40
|
'again.',
|
|
41
|
-
_a["cordova-not-ready" /* CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
42
|
-
_a["cors-unsupported" /* CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
43
|
-
_a["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
44
|
-
_a["custom-token-mismatch" /* CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
45
|
-
_a["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
41
|
+
_a["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
42
|
+
_a["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
43
|
+
_a["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
44
|
+
_a["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
45
|
+
_a["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
46
46
|
'again before retrying this request.',
|
|
47
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
47
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
48
48
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
49
49
|
'starting any other Firebase SDK.',
|
|
50
|
-
_a["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
50
|
+
_a["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
51
51
|
'conditions.',
|
|
52
|
-
_a["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
53
|
-
_a["email-already-in-use" /* EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
54
|
-
_a["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
52
|
+
_a["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
53
|
+
_a["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
54
|
+
_a["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
55
55
|
'no longer be configured to use the emulator. Try calling ' +
|
|
56
56
|
'"connectAuthEmulator()" sooner.',
|
|
57
|
-
_a["expired-action-code" /* EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
58
|
-
_a["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
59
|
-
_a["internal-error" /* INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
60
|
-
_a["invalid-app-credential" /* INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
57
|
+
_a["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
58
|
+
_a["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
59
|
+
_a["internal-error" /* AuthErrorCode.INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
60
|
+
_a["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
61
61
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
62
|
-
_a["invalid-app-id" /* INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
63
|
-
_a["invalid-user-token" /* INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
62
|
+
_a["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
63
|
+
_a["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
64
64
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
65
65
|
'the project associated with this API key.',
|
|
66
|
-
_a["invalid-auth-event" /* INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
67
|
-
_a["invalid-verification-code" /* INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
66
|
+
_a["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
67
|
+
_a["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
68
68
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
69
69
|
'verification code provided by the user.',
|
|
70
|
-
_a["invalid-continue-uri" /* INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
71
|
-
_a["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
70
|
+
_a["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
71
|
+
_a["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
72
72
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
73
73
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
74
74
|
'cordova-plugin-customurlscheme.',
|
|
75
|
-
_a["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
76
|
-
_a["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
77
|
-
_a["invalid-email" /* INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
78
|
-
_a["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
79
|
-
_a["invalid-api-key" /* INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
80
|
-
_a["invalid-cert-hash" /* INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
81
|
-
_a["invalid-credential" /* INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
82
|
-
_a["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
75
|
+
_a["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
76
|
+
_a["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
77
|
+
_a["invalid-email" /* AuthErrorCode.INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
78
|
+
_a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
79
|
+
_a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
80
|
+
_a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
81
|
+
_a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
82
|
+
_a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
83
83
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
84
|
-
_a["invalid-multi-factor-session" /* INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
85
|
-
_a["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
84
|
+
_a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
85
|
+
_a["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
86
86
|
'only supports OAuth providers.',
|
|
87
|
-
_a["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
87
|
+
_a["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
88
88
|
'specified API key.',
|
|
89
|
-
_a["unauthorized-domain" /* INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
89
|
+
_a["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
90
90
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
91
|
-
_a["invalid-action-code" /* INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
91
|
+
_a["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
92
92
|
'expired, or has already been used.',
|
|
93
|
-
_a["wrong-password" /* INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
94
|
-
_a["invalid-persistence-type" /* INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
95
|
-
_a["invalid-phone-number" /* INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
93
|
+
_a["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
94
|
+
_a["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
95
|
+
_a["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
96
96
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
97
97
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
98
98
|
'number including area code].',
|
|
99
|
-
_a["invalid-provider-id" /* INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
100
|
-
_a["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
99
|
+
_a["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
100
|
+
_a["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
101
101
|
'recipient email address is invalid.',
|
|
102
|
-
_a["invalid-sender" /* INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
102
|
+
_a["invalid-sender" /* AuthErrorCode.INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
103
103
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
104
|
-
_a["invalid-verification-id" /* INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
105
|
-
_a["invalid-tenant-id" /* INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
106
|
-
_a["login-blocked" /* LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
107
|
-
_a["missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
108
|
-
_a["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
104
|
+
_a["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
105
|
+
_a["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
106
|
+
_a["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
107
|
+
_a["missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */] = 'An Android Package Name must be provided if the Android App is required to be installed.',
|
|
108
|
+
_a["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
109
109
|
'by following the instructions in the Firebase console.',
|
|
110
|
-
_a["missing-app-credential" /* MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
110
|
+
_a["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
111
111
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
112
|
-
_a["missing-verification-code" /* MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
113
|
-
_a["missing-continue-uri" /* MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
114
|
-
_a["missing-iframe-start" /* MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
115
|
-
_a["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
116
|
-
_a["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
112
|
+
_a["missing-verification-code" /* AuthErrorCode.MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
113
|
+
_a["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
114
|
+
_a["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
115
|
+
_a["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
116
|
+
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
117
117
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
118
118
|
'in the ID token payload.',
|
|
119
|
-
_a["missing-multi-factor-info" /* MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
120
|
-
_a["missing-multi-factor-session" /* MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
121
|
-
_a["missing-phone-number" /* MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
122
|
-
_a["missing-verification-id" /* MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
123
|
-
_a["app-deleted" /* MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
124
|
-
_a["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
125
|
-
_a["multi-factor-auth-required" /* MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
126
|
-
_a["account-exists-with-different-credential" /* NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
119
|
+
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
120
|
+
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
121
|
+
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
122
|
+
_a["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
123
|
+
_a["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
124
|
+
_a["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
125
|
+
_a["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
126
|
+
_a["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
127
127
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
128
128
|
'email address.',
|
|
129
|
-
_a["network-request-failed" /* NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
130
|
-
_a["no-auth-event" /* NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
131
|
-
_a["no-such-provider" /* NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
132
|
-
_a["null-user" /* NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
129
|
+
_a["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
130
|
+
_a["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
131
|
+
_a["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
132
|
+
_a["null-user" /* AuthErrorCode.NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
133
133
|
'requires a non-null user object.',
|
|
134
|
-
_a["operation-not-allowed" /* OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
134
|
+
_a["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
135
135
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
136
136
|
'Auth section.',
|
|
137
|
-
_a["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
137
|
+
_a["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
138
138
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
139
139
|
' and web storage must be enabled.',
|
|
140
|
-
_a["popup-blocked" /* POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
141
|
-
_a["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
142
|
-
_a["provider-already-linked" /* PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
143
|
-
_a["quota-exceeded" /* QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
144
|
-
_a["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
145
|
-
_a["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
146
|
-
_a["rejected-credential" /* REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
147
|
-
_a["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
148
|
-
_a["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
149
|
-
_a["tenant-id-mismatch" /* TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
150
|
-
_a["timeout" /* TIMEOUT */] = 'The operation has timed out.',
|
|
151
|
-
_a["user-token-expired" /* TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
152
|
-
_a["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
140
|
+
_a["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
141
|
+
_a["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
142
|
+
_a["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
143
|
+
_a["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
144
|
+
_a["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
145
|
+
_a["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
146
|
+
_a["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
147
|
+
_a["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
148
|
+
_a["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
149
|
+
_a["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
150
|
+
_a["timeout" /* AuthErrorCode.TIMEOUT */] = 'The operation has timed out.',
|
|
151
|
+
_a["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
152
|
+
_a["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
153
153
|
'Try again later.',
|
|
154
|
-
_a["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
154
|
+
_a["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
155
155
|
'the domain in the Firebase console.',
|
|
156
|
-
_a["unsupported-first-factor" /* UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
157
|
-
_a["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
158
|
-
_a["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
159
|
-
_a["unverified-email" /* UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
160
|
-
_a["user-cancelled" /* USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
161
|
-
_a["user-not-found" /* USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
156
|
+
_a["unsupported-first-factor" /* AuthErrorCode.UNSUPPORTED_FIRST_FACTOR */] = 'Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.',
|
|
157
|
+
_a["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
158
|
+
_a["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
159
|
+
_a["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
160
|
+
_a["user-cancelled" /* AuthErrorCode.USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
161
|
+
_a["user-not-found" /* AuthErrorCode.USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
162
162
|
'have been deleted.',
|
|
163
|
-
_a["user-disabled" /* USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
164
|
-
_a["user-mismatch" /* USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
165
|
-
_a["user-signed-out" /* USER_SIGNED_OUT */] = '',
|
|
166
|
-
_a["weak-password" /* WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
167
|
-
_a["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
168
|
-
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
163
|
+
_a["user-disabled" /* AuthErrorCode.USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
164
|
+
_a["user-mismatch" /* AuthErrorCode.USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
165
|
+
_a["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */] = '',
|
|
166
|
+
_a["weak-password" /* AuthErrorCode.WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
167
|
+
_a["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
168
|
+
_a["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
169
169
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
170
170
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
171
171
|
' already initialized instance.',
|
|
@@ -177,7 +177,7 @@ function _prodErrorMap() {
|
|
|
177
177
|
// nature of this error, developers will never be able to see the message
|
|
178
178
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
179
179
|
return _a = {},
|
|
180
|
-
_a["dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
180
|
+
_a["dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */] = 'Another Firebase SDK was initialized and is trying to use Auth before Auth is ' +
|
|
181
181
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
182
182
|
'starting any other Firebase SDK.',
|
|
183
183
|
_a;
|
|
@@ -331,7 +331,7 @@ function _logError(msg) {
|
|
|
331
331
|
args[_i - 1] = arguments[_i];
|
|
332
332
|
}
|
|
333
333
|
if (logClient.logLevel <= logger.LogLevel.ERROR) {
|
|
334
|
-
logClient.error.apply(logClient, tslib.__spreadArray(["Auth ("
|
|
334
|
+
logClient.error.apply(logClient, tslib.__spreadArray(["Auth (".concat(app.SDK_VERSION, "): ").concat(msg)], args, false));
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
|
|
@@ -356,14 +356,14 @@ function _fail(authOrCode) {
|
|
|
356
356
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
357
357
|
rest[_i - 1] = arguments[_i];
|
|
358
358
|
}
|
|
359
|
-
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
359
|
+
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
360
360
|
}
|
|
361
361
|
function _createError(authOrCode) {
|
|
362
362
|
var rest = [];
|
|
363
363
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
364
364
|
rest[_i - 1] = arguments[_i];
|
|
365
365
|
}
|
|
366
|
-
return createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
366
|
+
return createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
367
367
|
}
|
|
368
368
|
function _errorWithCustomMessage(auth, code, message) {
|
|
369
369
|
var _a;
|
|
@@ -377,9 +377,9 @@ function _assertInstanceOf(auth, object, instance) {
|
|
|
377
377
|
var constructorInstance = instance;
|
|
378
378
|
if (!(object instanceof constructorInstance)) {
|
|
379
379
|
if (constructorInstance.name !== object.constructor.name) {
|
|
380
|
-
_fail(auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
380
|
+
_fail(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
381
381
|
}
|
|
382
|
-
throw _errorWithCustomMessage(auth, "argument-error" /* ARGUMENT_ERROR */, "Type of "
|
|
382
|
+
throw _errorWithCustomMessage(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, "Type of ".concat(object.constructor.name, " does not match expected instance.") +
|
|
383
383
|
"Did you pass a reference from a different Auth SDK?");
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -391,13 +391,13 @@ function createErrorInternal(authOrCode) {
|
|
|
391
391
|
}
|
|
392
392
|
if (typeof authOrCode !== 'string') {
|
|
393
393
|
var code = rest[0];
|
|
394
|
-
var fullParams = tslib.__spreadArray([], rest.slice(1));
|
|
394
|
+
var fullParams = tslib.__spreadArray([], rest.slice(1), true);
|
|
395
395
|
if (fullParams[0]) {
|
|
396
396
|
fullParams[0].appName = authOrCode.name;
|
|
397
397
|
}
|
|
398
|
-
return (_a = authOrCode._errorFactory).create.apply(_a, tslib.__spreadArray([code], fullParams));
|
|
398
|
+
return (_a = authOrCode._errorFactory).create.apply(_a, tslib.__spreadArray([code], fullParams, false));
|
|
399
399
|
}
|
|
400
|
-
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, tslib.__spreadArray([authOrCode], rest));
|
|
400
|
+
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, tslib.__spreadArray([authOrCode], rest, false));
|
|
401
401
|
}
|
|
402
402
|
function _assert(assertion, authOrCode) {
|
|
403
403
|
var rest = [];
|
|
@@ -405,7 +405,7 @@ function _assert(assertion, authOrCode) {
|
|
|
405
405
|
rest[_i - 2] = arguments[_i];
|
|
406
406
|
}
|
|
407
407
|
if (!assertion) {
|
|
408
|
-
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest));
|
|
408
|
+
throw createErrorInternal.apply(void 0, tslib.__spreadArray([authOrCode], rest, false));
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
/**
|
|
@@ -516,7 +516,7 @@ function initializeAuth(app$1, deps) {
|
|
|
516
516
|
return auth_1;
|
|
517
517
|
}
|
|
518
518
|
else {
|
|
519
|
-
_fail(auth_1, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
519
|
+
_fail(auth_1, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
var auth = provider.initialize({ options: deps });
|
|
@@ -644,7 +644,7 @@ var Delay = /** @class */ (function () {
|
|
|
644
644
|
Delay.prototype.get = function () {
|
|
645
645
|
if (!_isOnline()) {
|
|
646
646
|
// Pick the shorter timeout.
|
|
647
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
647
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
648
648
|
}
|
|
649
649
|
// If running in a mobile environment, return the long delay, otherwise
|
|
650
650
|
// return the short delay.
|
|
@@ -677,7 +677,7 @@ function _emulatorUrl(config, path) {
|
|
|
677
677
|
if (!path) {
|
|
678
678
|
return url;
|
|
679
679
|
}
|
|
680
|
-
return ""
|
|
680
|
+
return "".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
/**
|
|
@@ -760,64 +760,64 @@ var _a$1;
|
|
|
760
760
|
*/
|
|
761
761
|
var SERVER_ERROR_MAP = (_a$1 = {},
|
|
762
762
|
// Custom token errors.
|
|
763
|
-
_a$1["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
763
|
+
_a$1["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
764
764
|
// This can only happen if the SDK sends a bad request.
|
|
765
|
-
_a$1["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */] = "internal-error" /* INTERNAL_ERROR */,
|
|
765
|
+
_a$1["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
766
766
|
// Create Auth URI errors.
|
|
767
|
-
_a$1["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */] = "invalid-email" /* INVALID_EMAIL */,
|
|
767
|
+
_a$1["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */] = "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
768
768
|
// This can only happen if the SDK sends a bad request.
|
|
769
|
-
_a$1["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */] = "internal-error" /* INTERNAL_ERROR */,
|
|
769
|
+
_a$1["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
770
770
|
// Sign in with email and password errors (some apply to sign up too).
|
|
771
|
-
_a$1["INVALID_PASSWORD" /* INVALID_PASSWORD */] = "wrong-password" /* INVALID_PASSWORD */,
|
|
771
|
+
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
772
772
|
// This can only happen if the SDK sends a bad request.
|
|
773
|
-
_a$1["MISSING_PASSWORD" /* MISSING_PASSWORD */] = "internal-error" /* INTERNAL_ERROR */,
|
|
773
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
774
774
|
// Sign up with email and password errors.
|
|
775
|
-
_a$1["EMAIL_EXISTS" /* EMAIL_EXISTS */] = "email-already-in-use" /* EMAIL_EXISTS */,
|
|
776
|
-
_a$1["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
775
|
+
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
776
|
+
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
777
777
|
// Verify assertion for sign in with credential errors:
|
|
778
|
-
_a$1["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
779
|
-
_a$1["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
780
|
-
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
778
|
+
_a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
779
|
+
_a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
780
|
+
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
781
781
|
// This can only happen if the SDK sends a bad request.
|
|
782
|
-
_a$1["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
782
|
+
_a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
783
783
|
// Send Password reset email errors:
|
|
784
|
-
_a$1["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
785
|
-
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
786
|
-
_a$1["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */] = "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
787
|
-
_a$1["INVALID_OOB_CODE" /* INVALID_OOB_CODE */] = "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
784
|
+
_a$1["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
785
|
+
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
786
|
+
_a$1["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */] = "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
787
|
+
_a$1["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */] = "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
788
788
|
// This can only happen if the SDK sends a bad request.
|
|
789
|
-
_a$1["MISSING_OOB_CODE" /* MISSING_OOB_CODE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
789
|
+
_a$1["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
790
790
|
// Operations that require ID token in request:
|
|
791
|
-
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
792
|
-
_a$1["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */] = "invalid-user-token" /* INVALID_AUTH */,
|
|
793
|
-
_a$1["TOKEN_EXPIRED" /* TOKEN_EXPIRED */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
794
|
-
_a$1["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
791
|
+
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
792
|
+
_a$1["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */] = "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
793
|
+
_a$1["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
794
|
+
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
795
795
|
// Other errors.
|
|
796
|
-
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
796
|
+
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
797
797
|
// Phone Auth related errors.
|
|
798
|
-
_a$1["INVALID_CODE" /* INVALID_CODE */] = "invalid-verification-code" /* INVALID_CODE */,
|
|
799
|
-
_a$1["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */] = "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
800
|
-
_a$1["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
801
|
-
_a$1["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */] = "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
802
|
-
_a$1["SESSION_EXPIRED" /* SESSION_EXPIRED */] = "code-expired" /* CODE_EXPIRED */,
|
|
798
|
+
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
799
|
+
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
800
|
+
_a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
801
|
+
_a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
802
|
+
_a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
803
803
|
// Other action code errors when additional settings passed.
|
|
804
804
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
805
805
|
// This is OK as this error will be caught by client side validation.
|
|
806
|
-
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
807
|
-
_a$1["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
806
|
+
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
807
|
+
_a$1["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
808
808
|
// getProjectConfig errors when clientId is passed.
|
|
809
|
-
_a$1["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
809
|
+
_a$1["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
810
810
|
// User actions (sign-up or deletion) disabled errors.
|
|
811
|
-
_a$1["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
811
|
+
_a$1["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
812
812
|
// Multi factor related errors.
|
|
813
|
-
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
814
|
-
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
815
|
-
_a$1["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
816
|
-
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
817
|
-
_a$1["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
818
|
-
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
813
|
+
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
814
|
+
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
815
|
+
_a$1["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
816
|
+
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
817
|
+
_a$1["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
818
|
+
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
819
819
|
// Blocking functions related errors.
|
|
820
|
-
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
820
|
+
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
821
821
|
_a$1);
|
|
822
822
|
|
|
823
823
|
/**
|
|
@@ -856,7 +856,7 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
856
856
|
body = {};
|
|
857
857
|
params = {};
|
|
858
858
|
if (request) {
|
|
859
|
-
if (method === "GET" /* GET */) {
|
|
859
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
860
860
|
params = request;
|
|
861
861
|
}
|
|
862
862
|
else {
|
|
@@ -869,12 +869,11 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
869
869
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
870
870
|
case 1:
|
|
871
871
|
headers = _a.sent();
|
|
872
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
872
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
873
873
|
if (auth.languageCode) {
|
|
874
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
874
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
875
875
|
}
|
|
876
|
-
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), tslib.__assign({ method: method,
|
|
877
|
-
headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
876
|
+
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), tslib.__assign({ method: method, headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
878
877
|
}
|
|
879
878
|
});
|
|
880
879
|
}); })];
|
|
@@ -906,7 +905,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
906
905
|
case 3:
|
|
907
906
|
json = _b.sent();
|
|
908
907
|
if ('needConfirmation' in json) {
|
|
909
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
908
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
910
909
|
}
|
|
911
910
|
if (response.ok && !('errorMessage' in json)) {
|
|
912
911
|
return [2 /*return*/, json];
|
|
@@ -914,14 +913,14 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
914
913
|
else {
|
|
915
914
|
errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
916
915
|
_a = errorMessage.split(' : '), serverErrorCode = _a[0], serverErrorMessage = _a[1];
|
|
917
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
918
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
916
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
917
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
919
918
|
}
|
|
920
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
921
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
919
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
920
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
922
921
|
}
|
|
923
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
924
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
922
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
923
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
925
924
|
}
|
|
926
925
|
authError = errorMap[serverErrorCode] ||
|
|
927
926
|
serverErrorCode
|
|
@@ -940,7 +939,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
940
939
|
if (e_1 instanceof util.FirebaseError) {
|
|
941
940
|
throw e_1;
|
|
942
941
|
}
|
|
943
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
942
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
944
943
|
return [3 /*break*/, 5];
|
|
945
944
|
case 5: return [2 /*return*/];
|
|
946
945
|
}
|
|
@@ -957,7 +956,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
957
956
|
case 1:
|
|
958
957
|
serverResponse = (_a.sent());
|
|
959
958
|
if ('mfaPendingCredential' in serverResponse) {
|
|
960
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
959
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
961
960
|
_serverResponse: serverResponse
|
|
962
961
|
});
|
|
963
962
|
}
|
|
@@ -967,9 +966,9 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
967
966
|
});
|
|
968
967
|
}
|
|
969
968
|
function _getFinalTarget(auth, host, path, query) {
|
|
970
|
-
var base = ""
|
|
969
|
+
var base = "".concat(host).concat(path, "?").concat(query);
|
|
971
970
|
if (!auth.config.emulator) {
|
|
972
|
-
return auth.config.apiScheme
|
|
971
|
+
return "".concat(auth.config.apiScheme, "://").concat(base);
|
|
973
972
|
}
|
|
974
973
|
return _emulatorUrl(auth.config, base);
|
|
975
974
|
}
|
|
@@ -983,7 +982,7 @@ var NetworkTimeout = /** @class */ (function () {
|
|
|
983
982
|
this.timer = null;
|
|
984
983
|
this.promise = new Promise(function (_, reject) {
|
|
985
984
|
_this.timer = setTimeout(function () {
|
|
986
|
-
return reject(_createError(_this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
985
|
+
return reject(_createError(_this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
987
986
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
988
987
|
});
|
|
989
988
|
}
|
|
@@ -1027,21 +1026,21 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1027
1026
|
function deleteAccount(auth, request) {
|
|
1028
1027
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1029
1028
|
return tslib.__generator(this, function (_a) {
|
|
1030
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request)];
|
|
1029
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request)];
|
|
1031
1030
|
});
|
|
1032
1031
|
});
|
|
1033
1032
|
}
|
|
1034
1033
|
function deleteLinkedAccounts(auth, request) {
|
|
1035
1034
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1036
1035
|
return tslib.__generator(this, function (_a) {
|
|
1037
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
1036
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
1038
1037
|
});
|
|
1039
1038
|
});
|
|
1040
1039
|
}
|
|
1041
1040
|
function getAccountInfo(auth, request) {
|
|
1042
1041
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1043
1042
|
return tslib.__generator(this, function (_a) {
|
|
1044
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request)];
|
|
1043
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request)];
|
|
1045
1044
|
});
|
|
1046
1045
|
});
|
|
1047
1046
|
}
|
|
@@ -1137,7 +1136,7 @@ function getIdTokenResult(user, forceRefresh) {
|
|
|
1137
1136
|
case 1:
|
|
1138
1137
|
token = _a.sent();
|
|
1139
1138
|
claims = _parseToken(token);
|
|
1140
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1139
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1141
1140
|
firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
1142
1141
|
signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
1143
1142
|
return [2 /*return*/, {
|
|
@@ -1157,8 +1156,7 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
1157
1156
|
return Number(seconds) * 1000;
|
|
1158
1157
|
}
|
|
1159
1158
|
function _parseToken(token) {
|
|
1160
|
-
var _a;
|
|
1161
|
-
var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
|
|
1159
|
+
var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
|
|
1162
1160
|
if (algorithm === undefined ||
|
|
1163
1161
|
payload === undefined ||
|
|
1164
1162
|
signature === undefined) {
|
|
@@ -1174,7 +1172,7 @@ function _parseToken(token) {
|
|
|
1174
1172
|
return JSON.parse(decoded);
|
|
1175
1173
|
}
|
|
1176
1174
|
catch (e) {
|
|
1177
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
1175
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
1178
1176
|
return null;
|
|
1179
1177
|
}
|
|
1180
1178
|
}
|
|
@@ -1183,9 +1181,9 @@ function _parseToken(token) {
|
|
|
1183
1181
|
*/
|
|
1184
1182
|
function _tokenExpiresIn(token) {
|
|
1185
1183
|
var parsedToken = _parseToken(token);
|
|
1186
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1187
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1188
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1184
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1185
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1186
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1189
1187
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
1190
1188
|
}
|
|
1191
1189
|
|
|
@@ -1236,8 +1234,8 @@ function _logoutIfInvalidated(user, promise, bypassAuthState) {
|
|
|
1236
1234
|
}
|
|
1237
1235
|
function isUserInvalidated(_a) {
|
|
1238
1236
|
var code = _a.code;
|
|
1239
|
-
return (code === "auth/"
|
|
1240
|
-
code === "auth/"
|
|
1237
|
+
return (code === "auth/".concat("user-disabled" /* AuthErrorCode.USER_DISABLED */) ||
|
|
1238
|
+
code === "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */));
|
|
1241
1239
|
}
|
|
1242
1240
|
|
|
1243
1241
|
/**
|
|
@@ -1265,7 +1263,7 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1265
1263
|
// we can't cast properly in both environments.
|
|
1266
1264
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1267
1265
|
this.timerId = null;
|
|
1268
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1266
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1269
1267
|
}
|
|
1270
1268
|
ProactiveRefresh.prototype._start = function () {
|
|
1271
1269
|
if (this.isRunning) {
|
|
@@ -1287,14 +1285,14 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1287
1285
|
var _a;
|
|
1288
1286
|
if (wasError) {
|
|
1289
1287
|
var interval = this.errorBackoff;
|
|
1290
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
1288
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
1291
1289
|
return interval;
|
|
1292
1290
|
}
|
|
1293
1291
|
else {
|
|
1294
1292
|
// Reset the error backoff
|
|
1295
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
1293
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
1296
1294
|
var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
1297
|
-
var interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
1295
|
+
var interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
1298
1296
|
return Math.max(0, interval);
|
|
1299
1297
|
}
|
|
1300
1298
|
};
|
|
@@ -1318,22 +1316,21 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
1318
1316
|
}); }, interval);
|
|
1319
1317
|
};
|
|
1320
1318
|
ProactiveRefresh.prototype.iteration = function () {
|
|
1321
|
-
var _a;
|
|
1322
1319
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1323
1320
|
var e_1;
|
|
1324
|
-
return tslib.__generator(this, function (
|
|
1325
|
-
switch (
|
|
1321
|
+
return tslib.__generator(this, function (_a) {
|
|
1322
|
+
switch (_a.label) {
|
|
1326
1323
|
case 0:
|
|
1327
|
-
|
|
1324
|
+
_a.trys.push([0, 2, , 3]);
|
|
1328
1325
|
return [4 /*yield*/, this.user.getIdToken(true)];
|
|
1329
1326
|
case 1:
|
|
1330
|
-
|
|
1327
|
+
_a.sent();
|
|
1331
1328
|
return [3 /*break*/, 3];
|
|
1332
1329
|
case 2:
|
|
1333
|
-
e_1 =
|
|
1330
|
+
e_1 = _a.sent();
|
|
1334
1331
|
// Only retry on network errors
|
|
1335
|
-
if ((
|
|
1336
|
-
"auth/"
|
|
1332
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) ===
|
|
1333
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
1337
1334
|
this.schedule(/* wasError */ true);
|
|
1338
1335
|
}
|
|
1339
1336
|
return [2 /*return*/];
|
|
@@ -1417,7 +1414,7 @@ function _reloadWithoutSaving(user) {
|
|
|
1417
1414
|
return [4 /*yield*/, _logoutIfInvalidated(user, getAccountInfo(auth, { idToken: idToken }))];
|
|
1418
1415
|
case 2:
|
|
1419
1416
|
response = _b.sent();
|
|
1420
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1417
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1421
1418
|
coreAccount = response.users[0];
|
|
1422
1419
|
user._notifyReloadListener(coreAccount);
|
|
1423
1420
|
newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -1479,7 +1476,7 @@ function reload(user) {
|
|
|
1479
1476
|
}
|
|
1480
1477
|
function mergeProviderData(original, newData) {
|
|
1481
1478
|
var deduped = original.filter(function (o) { return !newData.some(function (n) { return n.providerId === o.providerId; }); });
|
|
1482
|
-
return tslib.__spreadArray(tslib.__spreadArray([], deduped), newData);
|
|
1479
|
+
return tslib.__spreadArray(tslib.__spreadArray([], deduped, true), newData, true);
|
|
1483
1480
|
}
|
|
1484
1481
|
function extractProviderData(providers) {
|
|
1485
1482
|
return providers.map(function (_a) {
|
|
@@ -1527,13 +1524,13 @@ function requestStsToken(auth, refreshToken) {
|
|
|
1527
1524
|
'refresh_token': refreshToken
|
|
1528
1525
|
}).slice(1);
|
|
1529
1526
|
_a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
|
|
1530
|
-
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key="
|
|
1527
|
+
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, "key=".concat(apiKey));
|
|
1531
1528
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1532
1529
|
case 1:
|
|
1533
1530
|
headers = _b.sent();
|
|
1534
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1531
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1535
1532
|
return [2 /*return*/, FetchProvider.fetch()(url, {
|
|
1536
|
-
method: "POST" /* POST */,
|
|
1533
|
+
method: "POST" /* HttpMethod.POST */,
|
|
1537
1534
|
headers: headers,
|
|
1538
1535
|
body: body
|
|
1539
1536
|
})];
|
|
@@ -1584,15 +1581,15 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1584
1581
|
Object.defineProperty(StsTokenManager.prototype, "isExpired", {
|
|
1585
1582
|
get: function () {
|
|
1586
1583
|
return (!this.expirationTime ||
|
|
1587
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
1584
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
1588
1585
|
},
|
|
1589
1586
|
enumerable: false,
|
|
1590
1587
|
configurable: true
|
|
1591
1588
|
});
|
|
1592
1589
|
StsTokenManager.prototype.updateFromServerResponse = function (response) {
|
|
1593
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
1594
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1595
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
1590
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1591
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1592
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1596
1593
|
var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
1597
1594
|
? Number(response.expiresIn)
|
|
1598
1595
|
: _tokenExpiresIn(response.idToken);
|
|
@@ -1604,7 +1601,7 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1604
1601
|
return tslib.__generator(this, function (_a) {
|
|
1605
1602
|
switch (_a.label) {
|
|
1606
1603
|
case 0:
|
|
1607
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
1604
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1608
1605
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1609
1606
|
return [2 /*return*/, this.accessToken];
|
|
1610
1607
|
}
|
|
@@ -1644,19 +1641,19 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1644
1641
|
var refreshToken = object.refreshToken, accessToken = object.accessToken, expirationTime = object.expirationTime;
|
|
1645
1642
|
var manager = new StsTokenManager();
|
|
1646
1643
|
if (refreshToken) {
|
|
1647
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1644
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1648
1645
|
appName: appName
|
|
1649
1646
|
});
|
|
1650
1647
|
manager.refreshToken = refreshToken;
|
|
1651
1648
|
}
|
|
1652
1649
|
if (accessToken) {
|
|
1653
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
1650
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1654
1651
|
appName: appName
|
|
1655
1652
|
});
|
|
1656
1653
|
manager.accessToken = accessToken;
|
|
1657
1654
|
}
|
|
1658
1655
|
if (expirationTime) {
|
|
1659
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
1656
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
1660
1657
|
appName: appName
|
|
1661
1658
|
});
|
|
1662
1659
|
manager.expirationTime = expirationTime;
|
|
@@ -1701,13 +1698,13 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1701
1698
|
* limitations under the License.
|
|
1702
1699
|
*/
|
|
1703
1700
|
function assertStringOrUndefined(assertion, appName) {
|
|
1704
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName: appName });
|
|
1701
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName: appName });
|
|
1705
1702
|
}
|
|
1706
1703
|
var UserImpl = /** @class */ (function () {
|
|
1707
1704
|
function UserImpl(_a) {
|
|
1708
1705
|
var uid = _a.uid, auth = _a.auth, stsTokenManager = _a.stsTokenManager, opt = tslib.__rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
1709
1706
|
// For the user object, provider is always Firebase.
|
|
1710
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
1707
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
1711
1708
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
1712
1709
|
this.reloadUserInfo = null;
|
|
1713
1710
|
this.reloadListener = null;
|
|
@@ -1722,7 +1719,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1722
1719
|
this.photoURL = opt.photoURL || null;
|
|
1723
1720
|
this.isAnonymous = opt.isAnonymous || false;
|
|
1724
1721
|
this.tenantId = opt.tenantId || null;
|
|
1725
|
-
this.providerData = opt.providerData ? tslib.__spreadArray([], opt.providerData) : [];
|
|
1722
|
+
this.providerData = opt.providerData ? tslib.__spreadArray([], opt.providerData, true) : [];
|
|
1726
1723
|
this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);
|
|
1727
1724
|
}
|
|
1728
1725
|
UserImpl.prototype.getIdToken = function (forceRefresh) {
|
|
@@ -1733,7 +1730,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1733
1730
|
case 0: return [4 /*yield*/, _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh))];
|
|
1734
1731
|
case 1:
|
|
1735
1732
|
accessToken = _a.sent();
|
|
1736
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1733
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1737
1734
|
if (!(this.accessToken !== accessToken)) return [3 /*break*/, 3];
|
|
1738
1735
|
this.accessToken = accessToken;
|
|
1739
1736
|
return [4 /*yield*/, this.auth._persistUserIfCurrent(this)];
|
|
@@ -1756,7 +1753,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1756
1753
|
if (this === user) {
|
|
1757
1754
|
return;
|
|
1758
1755
|
}
|
|
1759
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1756
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1760
1757
|
this.displayName = user.displayName;
|
|
1761
1758
|
this.photoURL = user.photoURL;
|
|
1762
1759
|
this.email = user.email;
|
|
@@ -1773,7 +1770,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1773
1770
|
};
|
|
1774
1771
|
UserImpl.prototype._onReload = function (callback) {
|
|
1775
1772
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
1776
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1773
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1777
1774
|
this.reloadListener = callback;
|
|
1778
1775
|
if (this.reloadUserInfo) {
|
|
1779
1776
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -1869,13 +1866,13 @@ var UserImpl = /** @class */ (function () {
|
|
|
1869
1866
|
var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1870
1867
|
var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
1871
1868
|
var uid = object.uid, emailVerified = object.emailVerified, isAnonymous = object.isAnonymous, providerData = object.providerData, plainObjectTokenManager = object.stsTokenManager;
|
|
1872
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1869
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1873
1870
|
var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
1874
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1871
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1875
1872
|
assertStringOrUndefined(displayName, auth.name);
|
|
1876
1873
|
assertStringOrUndefined(email, auth.name);
|
|
1877
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1878
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
1874
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1875
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1879
1876
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
1880
1877
|
assertStringOrUndefined(photoURL, auth.name);
|
|
1881
1878
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -1955,7 +1952,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
1955
1952
|
*/
|
|
1956
1953
|
var InMemoryPersistence = /** @class */ (function () {
|
|
1957
1954
|
function InMemoryPersistence() {
|
|
1958
|
-
this.type = "NONE" /* NONE */;
|
|
1955
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
1959
1956
|
this.storage = {};
|
|
1960
1957
|
}
|
|
1961
1958
|
InMemoryPersistence.prototype._isAvailable = function () {
|
|
@@ -2025,7 +2022,7 @@ var inMemoryPersistence = InMemoryPersistence;
|
|
|
2025
2022
|
* limitations under the License.
|
|
2026
2023
|
*/
|
|
2027
2024
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
2028
|
-
return "firebase" /* PERSISTENCE
|
|
2025
|
+
return "".concat("firebase" /* Namespace.PERSISTENCE */, ":").concat(key, ":").concat(apiKey, ":").concat(appName);
|
|
2029
2026
|
}
|
|
2030
2027
|
var PersistenceUserManager = /** @class */ (function () {
|
|
2031
2028
|
function PersistenceUserManager(persistence, auth, userKey) {
|
|
@@ -2034,7 +2031,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2034
2031
|
this.userKey = userKey;
|
|
2035
2032
|
var _a = this.auth, config = _a.config, name = _a.name;
|
|
2036
2033
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
2037
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
2034
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
2038
2035
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
2039
2036
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
2040
2037
|
}
|
|
@@ -2088,7 +2085,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2088
2085
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
2089
2086
|
};
|
|
2090
2087
|
PersistenceUserManager.create = function (auth, persistenceHierarchy, userKey) {
|
|
2091
|
-
if (userKey === void 0) { userKey = "authUser" /* AUTH_USER */; }
|
|
2088
|
+
if (userKey === void 0) { userKey = "authUser" /* KeyName.AUTH_USER */; }
|
|
2092
2089
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2093
2090
|
var availablePersistences, selectedPersistence, key, userToMigrate, _i, persistenceHierarchy_1, persistence, blob, user, migrationHierarchy;
|
|
2094
2091
|
var _this = this;
|
|
@@ -2215,42 +2212,42 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2215
2212
|
function _getBrowserName(userAgent) {
|
|
2216
2213
|
var ua = userAgent.toLowerCase();
|
|
2217
2214
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
2218
|
-
return "Opera" /* OPERA */;
|
|
2215
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
2219
2216
|
}
|
|
2220
2217
|
else if (_isIEMobile(ua)) {
|
|
2221
2218
|
// Windows phone IEMobile browser.
|
|
2222
|
-
return "IEMobile" /* IEMOBILE */;
|
|
2219
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
2223
2220
|
}
|
|
2224
2221
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
2225
|
-
return "IE" /* IE */;
|
|
2222
|
+
return "IE" /* BrowserName.IE */;
|
|
2226
2223
|
}
|
|
2227
2224
|
else if (ua.includes('edge/')) {
|
|
2228
|
-
return "Edge" /* EDGE */;
|
|
2225
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
2229
2226
|
}
|
|
2230
2227
|
else if (_isFirefox(ua)) {
|
|
2231
|
-
return "Firefox" /* FIREFOX */;
|
|
2228
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
2232
2229
|
}
|
|
2233
2230
|
else if (ua.includes('silk/')) {
|
|
2234
|
-
return "Silk" /* SILK */;
|
|
2231
|
+
return "Silk" /* BrowserName.SILK */;
|
|
2235
2232
|
}
|
|
2236
2233
|
else if (_isBlackBerry(ua)) {
|
|
2237
2234
|
// Blackberry browser.
|
|
2238
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
2235
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
2239
2236
|
}
|
|
2240
2237
|
else if (_isWebOS(ua)) {
|
|
2241
2238
|
// WebOS default browser.
|
|
2242
|
-
return "Webos" /* WEBOS */;
|
|
2239
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
2243
2240
|
}
|
|
2244
2241
|
else if (_isSafari(ua)) {
|
|
2245
|
-
return "Safari" /* SAFARI */;
|
|
2242
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
2246
2243
|
}
|
|
2247
2244
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
2248
2245
|
!ua.includes('edge/')) {
|
|
2249
|
-
return "Chrome" /* CHROME */;
|
|
2246
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
2250
2247
|
}
|
|
2251
2248
|
else if (_isAndroid(ua)) {
|
|
2252
2249
|
// Android stock browser.
|
|
2253
|
-
return "Android" /* ANDROID */;
|
|
2250
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
2254
2251
|
}
|
|
2255
2252
|
else {
|
|
2256
2253
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -2260,7 +2257,7 @@ function _getBrowserName(userAgent) {
|
|
|
2260
2257
|
return matches[1];
|
|
2261
2258
|
}
|
|
2262
2259
|
}
|
|
2263
|
-
return "Other" /* OTHER */;
|
|
2260
|
+
return "Other" /* BrowserName.OTHER */;
|
|
2264
2261
|
}
|
|
2265
2262
|
function _isFirefox(ua) {
|
|
2266
2263
|
if (ua === void 0) { ua = util.getUA(); }
|
|
@@ -2356,15 +2353,15 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2356
2353
|
if (frameworks === void 0) { frameworks = []; }
|
|
2357
2354
|
var reportedPlatform;
|
|
2358
2355
|
switch (clientPlatform) {
|
|
2359
|
-
case "Browser" /* BROWSER */:
|
|
2356
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
2360
2357
|
// In a browser environment, report the browser name.
|
|
2361
2358
|
reportedPlatform = _getBrowserName(util.getUA());
|
|
2362
2359
|
break;
|
|
2363
|
-
case "Worker" /* WORKER */:
|
|
2360
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
2364
2361
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
2365
2362
|
// worker from a browser.
|
|
2366
2363
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
2367
|
-
reportedPlatform = _getBrowserName(util.getUA())
|
|
2364
|
+
reportedPlatform = "".concat(_getBrowserName(util.getUA()), "-").concat(clientPlatform);
|
|
2368
2365
|
break;
|
|
2369
2366
|
default:
|
|
2370
2367
|
reportedPlatform = clientPlatform;
|
|
@@ -2372,7 +2369,7 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
2372
2369
|
var reportedFrameworks = frameworks.length
|
|
2373
2370
|
? frameworks.join(',')
|
|
2374
2371
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
2375
|
-
return reportedPlatform
|
|
2372
|
+
return "".concat(reportedPlatform, "/").concat("JsCore" /* ClientImplementation.CORE */, "/").concat(app.SDK_VERSION, "/").concat(reportedFrameworks);
|
|
2376
2373
|
}
|
|
2377
2374
|
|
|
2378
2375
|
/**
|
|
@@ -2425,43 +2422,42 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2425
2422
|
};
|
|
2426
2423
|
};
|
|
2427
2424
|
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
2428
|
-
var _a;
|
|
2429
2425
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2430
|
-
var onAbortStack, _i,
|
|
2431
|
-
return tslib.__generator(this, function (
|
|
2432
|
-
switch (
|
|
2426
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
2427
|
+
return tslib.__generator(this, function (_c) {
|
|
2428
|
+
switch (_c.label) {
|
|
2433
2429
|
case 0:
|
|
2434
2430
|
if (this.auth.currentUser === nextUser) {
|
|
2435
2431
|
return [2 /*return*/];
|
|
2436
2432
|
}
|
|
2437
2433
|
onAbortStack = [];
|
|
2438
|
-
|
|
2434
|
+
_c.label = 1;
|
|
2439
2435
|
case 1:
|
|
2440
|
-
|
|
2441
|
-
_i = 0,
|
|
2442
|
-
|
|
2436
|
+
_c.trys.push([1, 6, , 7]);
|
|
2437
|
+
_i = 0, _a = this.queue;
|
|
2438
|
+
_c.label = 2;
|
|
2443
2439
|
case 2:
|
|
2444
|
-
if (!(_i <
|
|
2445
|
-
beforeStateCallback =
|
|
2440
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
2441
|
+
beforeStateCallback = _a[_i];
|
|
2446
2442
|
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
2447
2443
|
case 3:
|
|
2448
|
-
|
|
2444
|
+
_c.sent();
|
|
2449
2445
|
// Only push the onAbort if the callback succeeds
|
|
2450
2446
|
if (beforeStateCallback.onAbort) {
|
|
2451
2447
|
onAbortStack.push(beforeStateCallback.onAbort);
|
|
2452
2448
|
}
|
|
2453
|
-
|
|
2449
|
+
_c.label = 4;
|
|
2454
2450
|
case 4:
|
|
2455
2451
|
_i++;
|
|
2456
2452
|
return [3 /*break*/, 2];
|
|
2457
2453
|
case 5: return [3 /*break*/, 7];
|
|
2458
2454
|
case 6:
|
|
2459
|
-
e_1 =
|
|
2455
|
+
e_1 = _c.sent();
|
|
2460
2456
|
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
2461
2457
|
// continue
|
|
2462
2458
|
onAbortStack.reverse();
|
|
2463
|
-
for (
|
|
2464
|
-
onAbort = onAbortStack_1[
|
|
2459
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
2460
|
+
onAbort = onAbortStack_1[_b];
|
|
2465
2461
|
try {
|
|
2466
2462
|
onAbort();
|
|
2467
2463
|
}
|
|
@@ -2469,8 +2465,8 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
2469
2465
|
/* swallow error */
|
|
2470
2466
|
}
|
|
2471
2467
|
}
|
|
2472
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
2473
|
-
originalMessage:
|
|
2468
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
2469
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
2474
2470
|
});
|
|
2475
2471
|
case 7: return [2 /*return*/];
|
|
2476
2472
|
}
|
|
@@ -2680,7 +2676,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2680
2676
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
2681
2677
|
}
|
|
2682
2678
|
case 9:
|
|
2683
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2679
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2684
2680
|
return [4 /*yield*/, this.getOrInitRedirectPersistenceManager()];
|
|
2685
2681
|
case 10:
|
|
2686
2682
|
_b.sent();
|
|
@@ -2728,21 +2724,20 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2728
2724
|
});
|
|
2729
2725
|
};
|
|
2730
2726
|
AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
|
|
2731
|
-
var _a;
|
|
2732
2727
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2733
2728
|
var e_4;
|
|
2734
|
-
return tslib.__generator(this, function (
|
|
2735
|
-
switch (
|
|
2729
|
+
return tslib.__generator(this, function (_a) {
|
|
2730
|
+
switch (_a.label) {
|
|
2736
2731
|
case 0:
|
|
2737
|
-
|
|
2732
|
+
_a.trys.push([0, 2, , 3]);
|
|
2738
2733
|
return [4 /*yield*/, _reloadWithoutSaving(user)];
|
|
2739
2734
|
case 1:
|
|
2740
|
-
|
|
2735
|
+
_a.sent();
|
|
2741
2736
|
return [3 /*break*/, 3];
|
|
2742
2737
|
case 2:
|
|
2743
|
-
e_4 =
|
|
2744
|
-
if ((
|
|
2745
|
-
"auth/"
|
|
2738
|
+
e_4 = _a.sent();
|
|
2739
|
+
if ((e_4 === null || e_4 === void 0 ? void 0 : e_4.code) !==
|
|
2740
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
2746
2741
|
// Something's wrong with the user's token. Log them out and remove
|
|
2747
2742
|
// them from storage
|
|
2748
2743
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
@@ -2772,7 +2767,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2772
2767
|
? util.getModularInstance(userExtern)
|
|
2773
2768
|
: null;
|
|
2774
2769
|
if (user) {
|
|
2775
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
2770
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
2776
2771
|
}
|
|
2777
2772
|
return [2 /*return*/, this._updateCurrentUser(user && user._clone(this))];
|
|
2778
2773
|
});
|
|
@@ -2789,7 +2784,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2789
2784
|
return [2 /*return*/];
|
|
2790
2785
|
}
|
|
2791
2786
|
if (user) {
|
|
2792
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
2787
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
2793
2788
|
}
|
|
2794
2789
|
if (!!skipBeforeStateCallbacks) return [3 /*break*/, 2];
|
|
2795
2790
|
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(user)];
|
|
@@ -2895,9 +2890,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2895
2890
|
if (!!this.redirectPersistenceManager) return [3 /*break*/, 3];
|
|
2896
2891
|
resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
2897
2892
|
this._popupRedirectResolver;
|
|
2898
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
2893
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
2899
2894
|
_a = this;
|
|
2900
|
-
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */)];
|
|
2895
|
+
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */)];
|
|
2901
2896
|
case 1:
|
|
2902
2897
|
_a.redirectPersistenceManager = _c.sent();
|
|
2903
2898
|
_b = this;
|
|
@@ -2957,7 +2952,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2957
2952
|
}
|
|
2958
2953
|
};
|
|
2959
2954
|
AuthImpl.prototype._key = function () {
|
|
2960
|
-
return this.config.authDomain
|
|
2955
|
+
return "".concat(this.config.authDomain, ":").concat(this.config.apiKey, ":").concat(this.name);
|
|
2961
2956
|
};
|
|
2962
2957
|
AuthImpl.prototype._startProactiveRefresh = function () {
|
|
2963
2958
|
this.isProactiveRefreshEnabled = true;
|
|
@@ -3002,7 +2997,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3002
2997
|
var promise = this._isInitialized
|
|
3003
2998
|
? Promise.resolve()
|
|
3004
2999
|
: this._initializationPromise;
|
|
3005
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3000
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3006
3001
|
// The callback needs to be called asynchronously per the spec.
|
|
3007
3002
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3008
3003
|
promise.then(function () { return cb(_this.currentUser); });
|
|
@@ -3052,7 +3047,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3052
3047
|
};
|
|
3053
3048
|
Object.defineProperty(AuthImpl.prototype, "assertedPersistence", {
|
|
3054
3049
|
get: function () {
|
|
3055
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3050
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3056
3051
|
return this.persistenceManager;
|
|
3057
3052
|
},
|
|
3058
3053
|
enumerable: false,
|
|
@@ -3080,10 +3075,10 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3080
3075
|
switch (_c.label) {
|
|
3081
3076
|
case 0:
|
|
3082
3077
|
headers = (_b = {},
|
|
3083
|
-
_b["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
|
|
3078
|
+
_b["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */] = this.clientVersion,
|
|
3084
3079
|
_b);
|
|
3085
3080
|
if (this.app.options.appId) {
|
|
3086
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3081
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3087
3082
|
}
|
|
3088
3083
|
return [4 /*yield*/, ((_a = this.heartbeatServiceProvider
|
|
3089
3084
|
.getImmediate({
|
|
@@ -3092,7 +3087,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3092
3087
|
case 1:
|
|
3093
3088
|
heartbeatsHeader = _c.sent();
|
|
3094
3089
|
if (heartbeatsHeader) {
|
|
3095
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3090
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
3096
3091
|
}
|
|
3097
3092
|
return [2 /*return*/, headers];
|
|
3098
3093
|
}
|
|
@@ -3120,7 +3115,7 @@ var Subscription = /** @class */ (function () {
|
|
|
3120
3115
|
}
|
|
3121
3116
|
Object.defineProperty(Subscription.prototype, "next", {
|
|
3122
3117
|
get: function () {
|
|
3123
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3118
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3124
3119
|
return this.observer.next.bind(this.observer);
|
|
3125
3120
|
},
|
|
3126
3121
|
enumerable: false,
|
|
@@ -3153,14 +3148,14 @@ var Subscription = /** @class */ (function () {
|
|
|
3153
3148
|
*/
|
|
3154
3149
|
function connectAuthEmulator(auth, url, options) {
|
|
3155
3150
|
var authInternal = _castAuth(auth);
|
|
3156
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
3157
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
3151
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
3152
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
3158
3153
|
var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
3159
3154
|
var protocol = extractProtocol(url);
|
|
3160
3155
|
var _a = extractHostAndPort(url), host = _a.host, port = _a.port;
|
|
3161
|
-
var portStr = port === null ? '' : ":"
|
|
3156
|
+
var portStr = port === null ? '' : ":".concat(port);
|
|
3162
3157
|
// Always replace path with "/" (even if input url had no path at all, or had a different one).
|
|
3163
|
-
authInternal.config.emulator = { url: protocol
|
|
3158
|
+
authInternal.config.emulator = { url: "".concat(protocol, "//").concat(host).concat(portStr, "/") };
|
|
3164
3159
|
authInternal.settings.appVerificationDisabledForTesting = true;
|
|
3165
3160
|
authInternal.emulatorConfig = Object.freeze({
|
|
3166
3161
|
host: host,
|
|
@@ -3325,21 +3320,21 @@ var AuthCredential = /** @class */ (function () {
|
|
|
3325
3320
|
function resetPassword(auth, request) {
|
|
3326
3321
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3327
3322
|
return tslib.__generator(this, function (_a) {
|
|
3328
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3323
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3329
3324
|
});
|
|
3330
3325
|
});
|
|
3331
3326
|
}
|
|
3332
3327
|
function updateEmailPassword(auth, request) {
|
|
3333
3328
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3334
3329
|
return tslib.__generator(this, function (_a) {
|
|
3335
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
3330
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
3336
3331
|
});
|
|
3337
3332
|
});
|
|
3338
3333
|
}
|
|
3339
3334
|
function applyActionCode$1(auth, request) {
|
|
3340
3335
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3341
3336
|
return tslib.__generator(this, function (_a) {
|
|
3342
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3337
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
3343
3338
|
});
|
|
3344
3339
|
});
|
|
3345
3340
|
}
|
|
@@ -3363,14 +3358,14 @@ function applyActionCode$1(auth, request) {
|
|
|
3363
3358
|
function signInWithPassword(auth, request) {
|
|
3364
3359
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3365
3360
|
return tslib.__generator(this, function (_a) {
|
|
3366
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3361
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
3367
3362
|
});
|
|
3368
3363
|
});
|
|
3369
3364
|
}
|
|
3370
3365
|
function sendOobCode(auth, request) {
|
|
3371
3366
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3372
3367
|
return tslib.__generator(this, function (_a) {
|
|
3373
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3368
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
3374
3369
|
});
|
|
3375
3370
|
});
|
|
3376
3371
|
}
|
|
@@ -3422,14 +3417,14 @@ function verifyAndChangeEmail(auth, request) {
|
|
|
3422
3417
|
function signInWithEmailLink$1(auth, request) {
|
|
3423
3418
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3424
3419
|
return tslib.__generator(this, function (_a) {
|
|
3425
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3420
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3426
3421
|
});
|
|
3427
3422
|
});
|
|
3428
3423
|
}
|
|
3429
3424
|
function signInWithEmailLinkForLinking(auth, request) {
|
|
3430
3425
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3431
3426
|
return tslib.__generator(this, function (_a) {
|
|
3432
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3427
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
3433
3428
|
});
|
|
3434
3429
|
});
|
|
3435
3430
|
}
|
|
@@ -3471,7 +3466,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3471
3466
|
/** @internal */
|
|
3472
3467
|
_tenantId) {
|
|
3473
3468
|
if (_tenantId === void 0) { _tenantId = null; }
|
|
3474
|
-
var _this = _super.call(this, "password" /* PASSWORD */, signInMethod) || this;
|
|
3469
|
+
var _this = _super.call(this, "password" /* ProviderId.PASSWORD */, signInMethod) || this;
|
|
3475
3470
|
_this._email = _email;
|
|
3476
3471
|
_this._password = _password;
|
|
3477
3472
|
_this._tenantId = _tenantId;
|
|
@@ -3479,12 +3474,12 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3479
3474
|
}
|
|
3480
3475
|
/** @internal */
|
|
3481
3476
|
EmailAuthCredential._fromEmailAndPassword = function (email, password) {
|
|
3482
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
3477
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
3483
3478
|
};
|
|
3484
3479
|
/** @internal */
|
|
3485
3480
|
EmailAuthCredential._fromEmailAndCode = function (email, oobCode, tenantId) {
|
|
3486
3481
|
if (tenantId === void 0) { tenantId = null; }
|
|
3487
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
3482
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
3488
3483
|
};
|
|
3489
3484
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
3490
3485
|
EmailAuthCredential.prototype.toJSON = function () {
|
|
@@ -3506,10 +3501,10 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3506
3501
|
EmailAuthCredential.fromJSON = function (json) {
|
|
3507
3502
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
3508
3503
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
3509
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
3504
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
3510
3505
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
3511
3506
|
}
|
|
3512
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
3507
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
3513
3508
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
3514
3509
|
}
|
|
3515
3510
|
}
|
|
@@ -3520,19 +3515,19 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3520
3515
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3521
3516
|
return tslib.__generator(this, function (_a) {
|
|
3522
3517
|
switch (this.signInMethod) {
|
|
3523
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3518
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3524
3519
|
return [2 /*return*/, signInWithPassword(auth, {
|
|
3525
3520
|
returnSecureToken: true,
|
|
3526
3521
|
email: this._email,
|
|
3527
3522
|
password: this._password
|
|
3528
3523
|
})];
|
|
3529
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3524
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3530
3525
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
3531
3526
|
email: this._email,
|
|
3532
3527
|
oobCode: this._password
|
|
3533
3528
|
})];
|
|
3534
3529
|
default:
|
|
3535
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3530
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3536
3531
|
}
|
|
3537
3532
|
return [2 /*return*/];
|
|
3538
3533
|
});
|
|
@@ -3543,21 +3538,21 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3543
3538
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3544
3539
|
return tslib.__generator(this, function (_a) {
|
|
3545
3540
|
switch (this.signInMethod) {
|
|
3546
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
3541
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3547
3542
|
return [2 /*return*/, updateEmailPassword(auth, {
|
|
3548
3543
|
idToken: idToken,
|
|
3549
3544
|
returnSecureToken: true,
|
|
3550
3545
|
email: this._email,
|
|
3551
3546
|
password: this._password
|
|
3552
3547
|
})];
|
|
3553
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
3548
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3554
3549
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
3555
3550
|
idToken: idToken,
|
|
3556
3551
|
email: this._email,
|
|
3557
3552
|
oobCode: this._password
|
|
3558
3553
|
})];
|
|
3559
3554
|
default:
|
|
3560
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
3555
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3561
3556
|
}
|
|
3562
3557
|
return [2 /*return*/];
|
|
3563
3558
|
});
|
|
@@ -3589,7 +3584,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
3589
3584
|
function signInWithIdp(auth, request) {
|
|
3590
3585
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3591
3586
|
return tslib.__generator(this, function (_a) {
|
|
3592
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3587
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
3593
3588
|
});
|
|
3594
3589
|
});
|
|
3595
3590
|
}
|
|
@@ -3651,7 +3646,7 @@ var OAuthCredential = /** @class */ (function (_super) {
|
|
|
3651
3646
|
cred.secret = params.oauthTokenSecret;
|
|
3652
3647
|
}
|
|
3653
3648
|
else {
|
|
3654
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
3649
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3655
3650
|
}
|
|
3656
3651
|
return cred;
|
|
3657
3652
|
};
|
|
@@ -3757,14 +3752,14 @@ var _a;
|
|
|
3757
3752
|
function sendPhoneVerificationCode(auth, request) {
|
|
3758
3753
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3759
3754
|
return tslib.__generator(this, function (_a) {
|
|
3760
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendVerificationCode" /* SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
3755
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendVerificationCode" /* Endpoint.SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
3761
3756
|
});
|
|
3762
3757
|
});
|
|
3763
3758
|
}
|
|
3764
3759
|
function signInWithPhoneNumber$1(auth, request) {
|
|
3765
3760
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3766
3761
|
return tslib.__generator(this, function (_a) {
|
|
3767
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3762
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3768
3763
|
});
|
|
3769
3764
|
});
|
|
3770
3765
|
}
|
|
@@ -3773,11 +3768,11 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3773
3768
|
var response;
|
|
3774
3769
|
return tslib.__generator(this, function (_a) {
|
|
3775
3770
|
switch (_a.label) {
|
|
3776
|
-
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3771
|
+
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
3777
3772
|
case 1:
|
|
3778
3773
|
response = _a.sent();
|
|
3779
3774
|
if (response.temporaryProof) {
|
|
3780
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
3775
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
3781
3776
|
}
|
|
3782
3777
|
return [2 /*return*/, response];
|
|
3783
3778
|
}
|
|
@@ -3785,14 +3780,14 @@ function linkWithPhoneNumber$1(auth, request) {
|
|
|
3785
3780
|
});
|
|
3786
3781
|
}
|
|
3787
3782
|
var VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = (_a = {},
|
|
3788
|
-
_a["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
3783
|
+
_a["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
3789
3784
|
_a);
|
|
3790
3785
|
function verifyPhoneNumberForExisting(auth, request) {
|
|
3791
3786
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3792
3787
|
var apiRequest;
|
|
3793
3788
|
return tslib.__generator(this, function (_a) {
|
|
3794
3789
|
apiRequest = tslib.__assign(tslib.__assign({}, request), { operation: 'REAUTH' });
|
|
3795
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
3790
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, apiRequest), VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_)];
|
|
3796
3791
|
});
|
|
3797
3792
|
});
|
|
3798
3793
|
}
|
|
@@ -3821,7 +3816,7 @@ function verifyPhoneNumberForExisting(auth, request) {
|
|
|
3821
3816
|
var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
3822
3817
|
tslib.__extends(PhoneAuthCredential, _super);
|
|
3823
3818
|
function PhoneAuthCredential(params) {
|
|
3824
|
-
var _this = _super.call(this, "phone" /* PHONE */, "phone" /* PHONE */) || this;
|
|
3819
|
+
var _this = _super.call(this, "phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */) || this;
|
|
3825
3820
|
_this.params = params;
|
|
3826
3821
|
return _this;
|
|
3827
3822
|
}
|
|
@@ -3921,17 +3916,17 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
|
3921
3916
|
function parseMode(mode) {
|
|
3922
3917
|
switch (mode) {
|
|
3923
3918
|
case 'recoverEmail':
|
|
3924
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
3919
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
3925
3920
|
case 'resetPassword':
|
|
3926
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
3921
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
3927
3922
|
case 'signIn':
|
|
3928
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
3923
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
3929
3924
|
case 'verifyEmail':
|
|
3930
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
3925
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
3931
3926
|
case 'verifyAndChangeEmail':
|
|
3932
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
3927
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
3933
3928
|
case 'revertSecondFactorAddition':
|
|
3934
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
3929
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
3935
3930
|
default:
|
|
3936
3931
|
return null;
|
|
3937
3932
|
}
|
|
@@ -3970,17 +3965,17 @@ var ActionCodeURL = /** @class */ (function () {
|
|
|
3970
3965
|
function ActionCodeURL(actionLink) {
|
|
3971
3966
|
var _a, _b, _c, _d, _e, _f;
|
|
3972
3967
|
var searchParams = util.querystringDecode(util.extractQuerystring(actionLink));
|
|
3973
|
-
var apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3974
|
-
var code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3975
|
-
var operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3968
|
+
var apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
3969
|
+
var code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
3970
|
+
var operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
3976
3971
|
// Validate API key, code and mode.
|
|
3977
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
3972
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3978
3973
|
this.apiKey = apiKey;
|
|
3979
3974
|
this.operation = operation;
|
|
3980
3975
|
this.code = code;
|
|
3981
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3982
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3983
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3976
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
3977
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
3978
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
3984
3979
|
}
|
|
3985
3980
|
/**
|
|
3986
3981
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -4085,21 +4080,21 @@ var EmailAuthProvider = /** @class */ (function () {
|
|
|
4085
4080
|
*/
|
|
4086
4081
|
EmailAuthProvider.credentialWithLink = function (email, emailLink) {
|
|
4087
4082
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
4088
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
4083
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4089
4084
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
4090
4085
|
};
|
|
4091
4086
|
/**
|
|
4092
4087
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
4093
4088
|
*/
|
|
4094
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
4089
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
4095
4090
|
/**
|
|
4096
4091
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
4097
4092
|
*/
|
|
4098
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
4093
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
4099
4094
|
/**
|
|
4100
4095
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
4101
4096
|
*/
|
|
4102
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
4097
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
4103
4098
|
return EmailAuthProvider;
|
|
4104
4099
|
}());
|
|
4105
4100
|
|
|
@@ -4216,7 +4211,7 @@ var BaseOAuthProvider = /** @class */ (function (_super) {
|
|
|
4216
4211
|
* Retrieve the current list of OAuth scopes.
|
|
4217
4212
|
*/
|
|
4218
4213
|
BaseOAuthProvider.prototype.getScopes = function () {
|
|
4219
|
-
return tslib.__spreadArray([], this.scopes);
|
|
4214
|
+
return tslib.__spreadArray([], this.scopes, true);
|
|
4220
4215
|
};
|
|
4221
4216
|
return BaseOAuthProvider;
|
|
4222
4217
|
}(FederatedAuthProvider));
|
|
@@ -4271,7 +4266,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4271
4266
|
*/
|
|
4272
4267
|
OAuthProvider.credentialFromJSON = function (json) {
|
|
4273
4268
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
4274
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
4269
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4275
4270
|
return OAuthCredential._fromParams(obj);
|
|
4276
4271
|
};
|
|
4277
4272
|
/**
|
|
@@ -4300,7 +4295,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4300
4295
|
};
|
|
4301
4296
|
/** An internal credential method that accepts more permissive options */
|
|
4302
4297
|
OAuthProvider.prototype._credential = function (params) {
|
|
4303
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
4298
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4304
4299
|
// For OAuthCredential, sign in method is same as providerId.
|
|
4305
4300
|
return OAuthCredential._fromParams(tslib.__assign(tslib.__assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
4306
4301
|
};
|
|
@@ -4409,7 +4404,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
4409
4404
|
var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
4410
4405
|
tslib.__extends(FacebookAuthProvider, _super);
|
|
4411
4406
|
function FacebookAuthProvider() {
|
|
4412
|
-
return _super.call(this, "facebook.com" /* FACEBOOK */) || this;
|
|
4407
|
+
return _super.call(this, "facebook.com" /* ProviderId.FACEBOOK */) || this;
|
|
4413
4408
|
}
|
|
4414
4409
|
/**
|
|
4415
4410
|
* Creates a credential for Facebook.
|
|
@@ -4463,9 +4458,9 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4463
4458
|
}
|
|
4464
4459
|
};
|
|
4465
4460
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
4466
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
4461
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
4467
4462
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
4468
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
4463
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
4469
4464
|
return FacebookAuthProvider;
|
|
4470
4465
|
}(BaseOAuthProvider));
|
|
4471
4466
|
|
|
@@ -4529,7 +4524,7 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
4529
4524
|
var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
4530
4525
|
tslib.__extends(GoogleAuthProvider, _super);
|
|
4531
4526
|
function GoogleAuthProvider() {
|
|
4532
|
-
var _this = _super.call(this, "google.com" /* GOOGLE */) || this;
|
|
4527
|
+
var _this = _super.call(this, "google.com" /* ProviderId.GOOGLE */) || this;
|
|
4533
4528
|
_this.addScope('profile');
|
|
4534
4529
|
return _this;
|
|
4535
4530
|
}
|
|
@@ -4589,9 +4584,9 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4589
4584
|
}
|
|
4590
4585
|
};
|
|
4591
4586
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
4592
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
4587
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
4593
4588
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
4594
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
4589
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
4595
4590
|
return GoogleAuthProvider;
|
|
4596
4591
|
}(BaseOAuthProvider));
|
|
4597
4592
|
|
|
@@ -4656,7 +4651,7 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
4656
4651
|
var GithubAuthProvider = /** @class */ (function (_super) {
|
|
4657
4652
|
tslib.__extends(GithubAuthProvider, _super);
|
|
4658
4653
|
function GithubAuthProvider() {
|
|
4659
|
-
return _super.call(this, "github.com" /* GITHUB */) || this;
|
|
4654
|
+
return _super.call(this, "github.com" /* ProviderId.GITHUB */) || this;
|
|
4660
4655
|
}
|
|
4661
4656
|
/**
|
|
4662
4657
|
* Creates a credential for Github.
|
|
@@ -4703,9 +4698,9 @@ var GithubAuthProvider = /** @class */ (function (_super) {
|
|
|
4703
4698
|
}
|
|
4704
4699
|
};
|
|
4705
4700
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
4706
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
4701
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
4707
4702
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
4708
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
4703
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
4709
4704
|
return GithubAuthProvider;
|
|
4710
4705
|
}(BaseOAuthProvider));
|
|
4711
4706
|
|
|
@@ -4829,10 +4824,8 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4829
4824
|
* @param providerId - SAML provider ID.
|
|
4830
4825
|
*/
|
|
4831
4826
|
function SAMLAuthProvider(providerId) {
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
_this = _super.call(this, providerId) || this;
|
|
4835
|
-
return _this;
|
|
4827
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4828
|
+
return _super.call(this, providerId) || this;
|
|
4836
4829
|
}
|
|
4837
4830
|
/**
|
|
4838
4831
|
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
|
|
@@ -4868,7 +4861,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4868
4861
|
*/
|
|
4869
4862
|
SAMLAuthProvider.credentialFromJSON = function (json) {
|
|
4870
4863
|
var credential = SAMLAuthCredential.fromJSON(json);
|
|
4871
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
4864
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4872
4865
|
return credential;
|
|
4873
4866
|
};
|
|
4874
4867
|
SAMLAuthProvider.samlCredentialFromTaggedObject = function (_a) {
|
|
@@ -4948,7 +4941,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
4948
4941
|
var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
4949
4942
|
tslib.__extends(TwitterAuthProvider, _super);
|
|
4950
4943
|
function TwitterAuthProvider() {
|
|
4951
|
-
return _super.call(this, "twitter.com" /* TWITTER */) || this;
|
|
4944
|
+
return _super.call(this, "twitter.com" /* ProviderId.TWITTER */) || this;
|
|
4952
4945
|
}
|
|
4953
4946
|
/**
|
|
4954
4947
|
* Creates a credential for Twitter.
|
|
@@ -4998,9 +4991,9 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
4998
4991
|
}
|
|
4999
4992
|
};
|
|
5000
4993
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
5001
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
4994
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
5002
4995
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
5003
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
4996
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
5004
4997
|
return TwitterAuthProvider;
|
|
5005
4998
|
}(BaseOAuthProvider));
|
|
5006
4999
|
|
|
@@ -5023,7 +5016,7 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5023
5016
|
function signUp(auth, request) {
|
|
5024
5017
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5025
5018
|
return tslib.__generator(this, function (_a) {
|
|
5026
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5019
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5027
5020
|
});
|
|
5028
5021
|
});
|
|
5029
5022
|
}
|
|
@@ -5098,7 +5091,7 @@ function providerIdForResponse(response) {
|
|
|
5098
5091
|
return response.providerId;
|
|
5099
5092
|
}
|
|
5100
5093
|
if ('phoneNumber' in response) {
|
|
5101
|
-
return "phone" /* PHONE */;
|
|
5094
|
+
return "phone" /* ProviderId.PHONE */;
|
|
5102
5095
|
}
|
|
5103
5096
|
return null;
|
|
5104
5097
|
}
|
|
@@ -5146,7 +5139,7 @@ function signInAnonymously(auth) {
|
|
|
5146
5139
|
return [2 /*return*/, new UserCredentialImpl({
|
|
5147
5140
|
user: authInternal.currentUser,
|
|
5148
5141
|
providerId: null,
|
|
5149
|
-
operationType: "signIn" /* SIGN_IN */
|
|
5142
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
5150
5143
|
})];
|
|
5151
5144
|
}
|
|
5152
5145
|
return [4 /*yield*/, signUp(authInternal, {
|
|
@@ -5154,7 +5147,7 @@ function signInAnonymously(auth) {
|
|
|
5154
5147
|
})];
|
|
5155
5148
|
case 2:
|
|
5156
5149
|
response = _b.sent();
|
|
5157
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true)];
|
|
5150
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true)];
|
|
5158
5151
|
case 3:
|
|
5159
5152
|
userCredential = _b.sent();
|
|
5160
5153
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -5185,8 +5178,9 @@ function signInAnonymously(auth) {
|
|
|
5185
5178
|
var MultiFactorError = /** @class */ (function (_super) {
|
|
5186
5179
|
tslib.__extends(MultiFactorError, _super);
|
|
5187
5180
|
function MultiFactorError(auth, error, operationType, user) {
|
|
5181
|
+
var _this = this;
|
|
5188
5182
|
var _a;
|
|
5189
|
-
|
|
5183
|
+
_this = _super.call(this, error.code, error.message) || this;
|
|
5190
5184
|
_this.operationType = operationType;
|
|
5191
5185
|
_this.user = user;
|
|
5192
5186
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -5205,11 +5199,11 @@ var MultiFactorError = /** @class */ (function (_super) {
|
|
|
5205
5199
|
return MultiFactorError;
|
|
5206
5200
|
}(util.FirebaseError));
|
|
5207
5201
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
5208
|
-
var idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
5202
|
+
var idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
5209
5203
|
? credential._getReauthenticationResolver(auth)
|
|
5210
5204
|
: credential._getIdTokenResponse(auth);
|
|
5211
5205
|
return idTokenProvider.catch(function (error) {
|
|
5212
|
-
if (error.code === "auth/"
|
|
5206
|
+
if (error.code === "auth/".concat("multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */)) {
|
|
5213
5207
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
5214
5208
|
}
|
|
5215
5209
|
throw error;
|
|
@@ -5292,7 +5286,7 @@ function unlink(user, providerId) {
|
|
|
5292
5286
|
userInternal.providerData = userInternal.providerData.filter(function (pd) {
|
|
5293
5287
|
return providersLeft.has(pd.providerId);
|
|
5294
5288
|
});
|
|
5295
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
5289
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
5296
5290
|
userInternal.phoneNumber = null;
|
|
5297
5291
|
}
|
|
5298
5292
|
return [4 /*yield*/, userInternal.auth._persistUserIfCurrent(userInternal)];
|
|
@@ -5315,10 +5309,11 @@ function _link(user, credential, bypassAuthState) {
|
|
|
5315
5309
|
_d = (_c = credential)._linkToIdToken;
|
|
5316
5310
|
_e = [user.auth];
|
|
5317
5311
|
return [4 /*yield*/, user.getIdToken()];
|
|
5318
|
-
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5312
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
5313
|
+
bypassAuthState]))];
|
|
5319
5314
|
case 2:
|
|
5320
5315
|
response = _f.sent();
|
|
5321
|
-
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* LINK */, response)];
|
|
5316
|
+
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response)];
|
|
5322
5317
|
}
|
|
5323
5318
|
});
|
|
5324
5319
|
});
|
|
@@ -5333,8 +5328,8 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5333
5328
|
_a.sent();
|
|
5334
5329
|
providerIds = providerDataAsNames(user.providerData);
|
|
5335
5330
|
code = expected === false
|
|
5336
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
5337
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
5331
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
5332
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
5338
5333
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
5339
5334
|
return [2 /*return*/];
|
|
5340
5335
|
}
|
|
@@ -5359,32 +5354,31 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
5359
5354
|
* limitations under the License.
|
|
5360
5355
|
*/
|
|
5361
5356
|
function _reauthenticate(user, credential, bypassAuthState) {
|
|
5362
|
-
var _a;
|
|
5363
5357
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
5364
5358
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5365
5359
|
var auth, operationType, response, parsed, localId, e_1;
|
|
5366
|
-
return tslib.__generator(this, function (
|
|
5367
|
-
switch (
|
|
5360
|
+
return tslib.__generator(this, function (_a) {
|
|
5361
|
+
switch (_a.label) {
|
|
5368
5362
|
case 0:
|
|
5369
5363
|
auth = user.auth;
|
|
5370
|
-
operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
5371
|
-
|
|
5364
|
+
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
5365
|
+
_a.label = 1;
|
|
5372
5366
|
case 1:
|
|
5373
|
-
|
|
5367
|
+
_a.trys.push([1, 3, , 4]);
|
|
5374
5368
|
return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
|
|
5375
5369
|
case 2:
|
|
5376
|
-
response =
|
|
5377
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5370
|
+
response = _a.sent();
|
|
5371
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5378
5372
|
parsed = _parseToken(response.idToken);
|
|
5379
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5373
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5380
5374
|
localId = parsed.sub;
|
|
5381
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5375
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5382
5376
|
return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
|
|
5383
5377
|
case 3:
|
|
5384
|
-
e_1 =
|
|
5378
|
+
e_1 = _a.sent();
|
|
5385
5379
|
// Convert user deleted error into user mismatch
|
|
5386
|
-
if ((
|
|
5387
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
5380
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/".concat("user-not-found" /* AuthErrorCode.USER_DELETED */)) {
|
|
5381
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
5388
5382
|
}
|
|
5389
5383
|
throw e_1;
|
|
5390
5384
|
case 4: return [2 /*return*/];
|
|
@@ -5416,7 +5410,7 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
5416
5410
|
return tslib.__generator(this, function (_a) {
|
|
5417
5411
|
switch (_a.label) {
|
|
5418
5412
|
case 0:
|
|
5419
|
-
operationType = "signIn" /* SIGN_IN */;
|
|
5413
|
+
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
5420
5414
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
5421
5415
|
case 1:
|
|
5422
5416
|
response = _a.sent();
|
|
@@ -5516,7 +5510,7 @@ function reauthenticateWithCredential(user, credential) {
|
|
|
5516
5510
|
function signInWithCustomToken$1(auth, request) {
|
|
5517
5511
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
5518
5512
|
return tslib.__generator(this, function (_a) {
|
|
5519
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5513
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
5520
5514
|
});
|
|
5521
5515
|
});
|
|
5522
5516
|
}
|
|
@@ -5566,7 +5560,7 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
5566
5560
|
})];
|
|
5567
5561
|
case 1:
|
|
5568
5562
|
response = _a.sent();
|
|
5569
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5563
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5570
5564
|
case 2:
|
|
5571
5565
|
cred = _a.sent();
|
|
5572
5566
|
return [4 /*yield*/, authInternal._updateCurrentUser(cred.user)];
|
|
@@ -5605,14 +5599,14 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
5605
5599
|
if ('phoneInfo' in enrollment) {
|
|
5606
5600
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
5607
5601
|
}
|
|
5608
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
5602
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5609
5603
|
};
|
|
5610
5604
|
return MultiFactorInfoImpl;
|
|
5611
5605
|
}());
|
|
5612
5606
|
var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
5613
5607
|
tslib.__extends(PhoneMultiFactorInfoImpl, _super);
|
|
5614
5608
|
function PhoneMultiFactorInfoImpl(response) {
|
|
5615
|
-
var _this = _super.call(this, "phone" /* PHONE */, response) || this;
|
|
5609
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */, response) || this;
|
|
5616
5610
|
_this.phoneNumber = response.phoneInfo;
|
|
5617
5611
|
return _this;
|
|
5618
5612
|
}
|
|
@@ -5640,18 +5634,18 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
5640
5634
|
*/
|
|
5641
5635
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
5642
5636
|
var _a;
|
|
5643
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
5637
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
5644
5638
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
5645
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5639
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
5646
5640
|
request.continueUrl = actionCodeSettings.url;
|
|
5647
5641
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
5648
5642
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
5649
5643
|
if (actionCodeSettings.iOS) {
|
|
5650
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
5644
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
5651
5645
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
5652
5646
|
}
|
|
5653
5647
|
if (actionCodeSettings.android) {
|
|
5654
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
5648
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
5655
5649
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
5656
5650
|
request.androidMinimumVersionCode =
|
|
5657
5651
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -5715,7 +5709,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
5715
5709
|
case 0:
|
|
5716
5710
|
authModular = util.getModularInstance(auth);
|
|
5717
5711
|
request = {
|
|
5718
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
5712
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5719
5713
|
email: email
|
|
5720
5714
|
};
|
|
5721
5715
|
if (actionCodeSettings) {
|
|
@@ -5794,18 +5788,18 @@ function checkActionCode(auth, oobCode) {
|
|
|
5794
5788
|
case 1:
|
|
5795
5789
|
response = _a.sent();
|
|
5796
5790
|
operation = response.requestType;
|
|
5797
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5791
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5798
5792
|
switch (operation) {
|
|
5799
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
5793
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
5800
5794
|
break;
|
|
5801
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
5802
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5795
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
5796
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5803
5797
|
break;
|
|
5804
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
5805
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5798
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
5799
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5806
5800
|
// fall through
|
|
5807
5801
|
default:
|
|
5808
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
5802
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
5809
5803
|
}
|
|
5810
5804
|
multiFactorInfo = null;
|
|
5811
5805
|
if (response.mfaInfo) {
|
|
@@ -5813,10 +5807,10 @@ function checkActionCode(auth, oobCode) {
|
|
|
5813
5807
|
}
|
|
5814
5808
|
return [2 /*return*/, {
|
|
5815
5809
|
data: {
|
|
5816
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5810
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5817
5811
|
? response.newEmail
|
|
5818
5812
|
: response.email) || null,
|
|
5819
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
5813
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
5820
5814
|
? response.email
|
|
5821
5815
|
: response.newEmail) || null,
|
|
5822
5816
|
multiFactorInfo: multiFactorInfo
|
|
@@ -5882,7 +5876,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5882
5876
|
})];
|
|
5883
5877
|
case 1:
|
|
5884
5878
|
response = _a.sent();
|
|
5885
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
5879
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
5886
5880
|
case 2:
|
|
5887
5881
|
userCredential = _a.sent();
|
|
5888
5882
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -5975,10 +5969,10 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5975
5969
|
case 0:
|
|
5976
5970
|
authModular = util.getModularInstance(auth);
|
|
5977
5971
|
request = {
|
|
5978
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
5972
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
5979
5973
|
email: email
|
|
5980
5974
|
};
|
|
5981
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
5975
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5982
5976
|
if (actionCodeSettings) {
|
|
5983
5977
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
5984
5978
|
}
|
|
@@ -6000,7 +5994,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6000
5994
|
*/
|
|
6001
5995
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
6002
5996
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
6003
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
5997
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
6004
5998
|
}
|
|
6005
5999
|
/**
|
|
6006
6000
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -6047,7 +6041,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6047
6041
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
6048
6042
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
6049
6043
|
// instance.
|
|
6050
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
6044
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
6051
6045
|
return [2 /*return*/, signInWithCredential(authModular, credential)];
|
|
6052
6046
|
});
|
|
6053
6047
|
});
|
|
@@ -6072,7 +6066,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6072
6066
|
function createAuthUri(auth, request) {
|
|
6073
6067
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6074
6068
|
return tslib.__generator(this, function (_a) {
|
|
6075
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6069
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6076
6070
|
});
|
|
6077
6071
|
});
|
|
6078
6072
|
}
|
|
@@ -6167,7 +6161,7 @@ function sendEmailVerification(user, actionCodeSettings) {
|
|
|
6167
6161
|
case 1:
|
|
6168
6162
|
idToken = _a.sent();
|
|
6169
6163
|
request = {
|
|
6170
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
6164
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
6171
6165
|
idToken: idToken
|
|
6172
6166
|
};
|
|
6173
6167
|
if (actionCodeSettings) {
|
|
@@ -6231,7 +6225,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6231
6225
|
case 1:
|
|
6232
6226
|
idToken = _a.sent();
|
|
6233
6227
|
request = {
|
|
6234
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
6228
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
6235
6229
|
idToken: idToken,
|
|
6236
6230
|
newEmail: newEmail
|
|
6237
6231
|
};
|
|
@@ -6275,7 +6269,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
6275
6269
|
function updateProfile$1(auth, request) {
|
|
6276
6270
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6277
6271
|
return tslib.__generator(this, function (_a) {
|
|
6278
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
6272
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
6279
6273
|
});
|
|
6280
6274
|
});
|
|
6281
6275
|
}
|
|
@@ -6331,7 +6325,7 @@ function updateProfile(user, _a) {
|
|
|
6331
6325
|
userInternal.photoURL = response.photoUrl || null;
|
|
6332
6326
|
passwordProvider = userInternal.providerData.find(function (_a) {
|
|
6333
6327
|
var providerId = _a.providerId;
|
|
6334
|
-
return providerId === "password" /* PASSWORD */;
|
|
6328
|
+
return providerId === "password" /* ProviderId.PASSWORD */;
|
|
6335
6329
|
});
|
|
6336
6330
|
if (passwordProvider) {
|
|
6337
6331
|
passwordProvider.displayName = userInternal.displayName;
|
|
@@ -6442,12 +6436,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6442
6436
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
6443
6437
|
: {};
|
|
6444
6438
|
var isNewUser = idTokenResponse.isNewUser ||
|
|
6445
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
6439
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
6446
6440
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
6447
6441
|
var signInProvider = (_b = (_a = _parseToken(idTokenResponse.idToken)) === null || _a === void 0 ? void 0 : _a.firebase) === null || _b === void 0 ? void 0 : _b['sign_in_provider'];
|
|
6448
6442
|
if (signInProvider) {
|
|
6449
|
-
var filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
6450
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
6443
|
+
var filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
6444
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
6451
6445
|
? signInProvider
|
|
6452
6446
|
: null;
|
|
6453
6447
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -6458,16 +6452,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
6458
6452
|
return null;
|
|
6459
6453
|
}
|
|
6460
6454
|
switch (providerId) {
|
|
6461
|
-
case "facebook.com" /* FACEBOOK */:
|
|
6455
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
6462
6456
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
6463
|
-
case "github.com" /* GITHUB */:
|
|
6457
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
6464
6458
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
6465
|
-
case "google.com" /* GOOGLE */:
|
|
6459
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
6466
6460
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
6467
|
-
case "twitter.com" /* TWITTER */:
|
|
6461
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
6468
6462
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
6469
|
-
case "custom" /* CUSTOM */:
|
|
6470
|
-
case "anonymous" /* ANONYMOUS */:
|
|
6463
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
6464
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
6471
6465
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
6472
6466
|
default:
|
|
6473
6467
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -6494,28 +6488,28 @@ var FederatedAdditionalUserInfoWithUsername = /** @class */ (function (_super) {
|
|
|
6494
6488
|
var FacebookAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6495
6489
|
tslib.__extends(FacebookAdditionalUserInfo, _super);
|
|
6496
6490
|
function FacebookAdditionalUserInfo(isNewUser, profile) {
|
|
6497
|
-
return _super.call(this, isNewUser, "facebook.com" /* FACEBOOK */, profile) || this;
|
|
6491
|
+
return _super.call(this, isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile) || this;
|
|
6498
6492
|
}
|
|
6499
6493
|
return FacebookAdditionalUserInfo;
|
|
6500
6494
|
}(GenericAdditionalUserInfo));
|
|
6501
6495
|
var GithubAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6502
6496
|
tslib.__extends(GithubAdditionalUserInfo, _super);
|
|
6503
6497
|
function GithubAdditionalUserInfo(isNewUser, profile) {
|
|
6504
|
-
return _super.call(this, isNewUser, "github.com" /* GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
6498
|
+
return _super.call(this, isNewUser, "github.com" /* ProviderId.GITHUB */, profile, typeof (profile === null || profile === void 0 ? void 0 : profile.login) === 'string' ? profile === null || profile === void 0 ? void 0 : profile.login : null) || this;
|
|
6505
6499
|
}
|
|
6506
6500
|
return GithubAdditionalUserInfo;
|
|
6507
6501
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
6508
6502
|
var GoogleAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6509
6503
|
tslib.__extends(GoogleAdditionalUserInfo, _super);
|
|
6510
6504
|
function GoogleAdditionalUserInfo(isNewUser, profile) {
|
|
6511
|
-
return _super.call(this, isNewUser, "google.com" /* GOOGLE */, profile) || this;
|
|
6505
|
+
return _super.call(this, isNewUser, "google.com" /* ProviderId.GOOGLE */, profile) || this;
|
|
6512
6506
|
}
|
|
6513
6507
|
return GoogleAdditionalUserInfo;
|
|
6514
6508
|
}(GenericAdditionalUserInfo));
|
|
6515
6509
|
var TwitterAdditionalUserInfo = /** @class */ (function (_super) {
|
|
6516
6510
|
tslib.__extends(TwitterAdditionalUserInfo, _super);
|
|
6517
6511
|
function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {
|
|
6518
|
-
return _super.call(this, isNewUser, "twitter.com" /* TWITTER */, profile, screenName) || this;
|
|
6512
|
+
return _super.call(this, isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName) || this;
|
|
6519
6513
|
}
|
|
6520
6514
|
return TwitterAdditionalUserInfo;
|
|
6521
6515
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
@@ -6698,14 +6692,14 @@ var MultiFactorSessionImpl = /** @class */ (function () {
|
|
|
6698
6692
|
this.auth = auth;
|
|
6699
6693
|
}
|
|
6700
6694
|
MultiFactorSessionImpl._fromIdtoken = function (idToken, auth) {
|
|
6701
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
6695
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
6702
6696
|
};
|
|
6703
6697
|
MultiFactorSessionImpl._fromMfaPendingCredential = function (mfaPendingCredential) {
|
|
6704
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
6698
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
6705
6699
|
};
|
|
6706
6700
|
MultiFactorSessionImpl.prototype.toJSON = function () {
|
|
6707
6701
|
var _a;
|
|
6708
|
-
var key = this.type === "enroll" /* ENROLL */
|
|
6702
|
+
var key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
6709
6703
|
? 'idToken'
|
|
6710
6704
|
: 'pendingCredential';
|
|
6711
6705
|
return {
|
|
@@ -6759,7 +6753,7 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6759
6753
|
var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
|
|
6760
6754
|
return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
6761
6755
|
});
|
|
6762
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6756
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6763
6757
|
var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
6764
6758
|
return new MultiFactorResolverImpl(session, hints, function (assertion) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
6765
6759
|
var mfaResponse, idTokenResponse, _a, userCredential;
|
|
@@ -6774,8 +6768,8 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6774
6768
|
idTokenResponse = tslib.__assign(tslib.__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
6775
6769
|
_a = error.operationType;
|
|
6776
6770
|
switch (_a) {
|
|
6777
|
-
case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
|
|
6778
|
-
case "reauthenticate" /* REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6771
|
+
case "signIn" /* OperationType.SIGN_IN */: return [3 /*break*/, 2];
|
|
6772
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
6779
6773
|
}
|
|
6780
6774
|
return [3 /*break*/, 6];
|
|
6781
6775
|
case 2: return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse)];
|
|
@@ -6786,10 +6780,10 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
6786
6780
|
_b.sent();
|
|
6787
6781
|
return [2 /*return*/, userCredential];
|
|
6788
6782
|
case 5:
|
|
6789
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6783
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6790
6784
|
return [2 /*return*/, UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse)];
|
|
6791
6785
|
case 6:
|
|
6792
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6786
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6793
6787
|
_b.label = 7;
|
|
6794
6788
|
case 7: return [2 /*return*/];
|
|
6795
6789
|
}
|
|
@@ -6821,8 +6815,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6821
6815
|
var _a;
|
|
6822
6816
|
var authModular = util.getModularInstance(auth);
|
|
6823
6817
|
var errorInternal = error;
|
|
6824
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6825
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6818
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6819
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6826
6820
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
6827
6821
|
}
|
|
6828
6822
|
|
|
@@ -6843,13 +6837,13 @@ function getMultiFactorResolver(auth, error) {
|
|
|
6843
6837
|
* limitations under the License.
|
|
6844
6838
|
*/
|
|
6845
6839
|
function startEnrollPhoneMfa(auth, request) {
|
|
6846
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:start" /* START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6840
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6847
6841
|
}
|
|
6848
6842
|
function finalizeEnrollPhoneMfa(auth, request) {
|
|
6849
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:finalize" /* FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6843
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
6850
6844
|
}
|
|
6851
6845
|
function withdrawMfa(auth, request) {
|
|
6852
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6846
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
6853
6847
|
}
|
|
6854
6848
|
|
|
6855
6849
|
var MultiFactorUserImpl = /** @class */ (function () {
|
|
@@ -6910,22 +6904,21 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
6910
6904
|
});
|
|
6911
6905
|
};
|
|
6912
6906
|
MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
|
|
6913
|
-
var _a;
|
|
6914
6907
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6915
6908
|
var mfaEnrollmentId, idToken, idTokenResponse, e_1;
|
|
6916
|
-
return tslib.__generator(this, function (
|
|
6917
|
-
switch (
|
|
6909
|
+
return tslib.__generator(this, function (_a) {
|
|
6910
|
+
switch (_a.label) {
|
|
6918
6911
|
case 0:
|
|
6919
6912
|
mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
6920
6913
|
return [4 /*yield*/, this.user.getIdToken()];
|
|
6921
6914
|
case 1:
|
|
6922
|
-
idToken =
|
|
6915
|
+
idToken = _a.sent();
|
|
6923
6916
|
return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
6924
6917
|
idToken: idToken,
|
|
6925
6918
|
mfaEnrollmentId: mfaEnrollmentId
|
|
6926
6919
|
}))];
|
|
6927
6920
|
case 2:
|
|
6928
|
-
idTokenResponse =
|
|
6921
|
+
idTokenResponse = _a.sent();
|
|
6929
6922
|
// Remove the second factor from the user's list.
|
|
6930
6923
|
this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
|
|
6931
6924
|
var uid = _a.uid;
|
|
@@ -6941,17 +6934,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
6941
6934
|
// the tokenResponse may be empty. If the tokens were not updated (and they
|
|
6942
6935
|
// are now invalid), reloading the user will discover this and invalidate
|
|
6943
6936
|
// the user's state accordingly.
|
|
6944
|
-
|
|
6945
|
-
|
|
6937
|
+
_a.sent();
|
|
6938
|
+
_a.label = 4;
|
|
6946
6939
|
case 4:
|
|
6947
|
-
|
|
6940
|
+
_a.trys.push([4, 6, , 7]);
|
|
6948
6941
|
return [4 /*yield*/, this.user.reload()];
|
|
6949
6942
|
case 5:
|
|
6950
|
-
|
|
6943
|
+
_a.sent();
|
|
6951
6944
|
return [3 /*break*/, 7];
|
|
6952
6945
|
case 6:
|
|
6953
|
-
e_1 =
|
|
6954
|
-
if ((
|
|
6946
|
+
e_1 = _a.sent();
|
|
6947
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
|
|
6955
6948
|
throw e_1;
|
|
6956
6949
|
}
|
|
6957
6950
|
return [3 /*break*/, 7];
|
|
@@ -6982,7 +6975,7 @@ function multiFactor(user) {
|
|
|
6982
6975
|
}
|
|
6983
6976
|
|
|
6984
6977
|
var name = "@firebase/auth";
|
|
6985
|
-
var version = "0.
|
|
6978
|
+
var version = "0.21.0";
|
|
6986
6979
|
|
|
6987
6980
|
/**
|
|
6988
6981
|
* @license
|
|
@@ -7037,8 +7030,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7037
7030
|
return;
|
|
7038
7031
|
}
|
|
7039
7032
|
var unsubscribe = this.auth.onIdTokenChanged(function (user) {
|
|
7040
|
-
|
|
7041
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
7033
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
7042
7034
|
});
|
|
7043
7035
|
this.internalListeners.set(listener, unsubscribe);
|
|
7044
7036
|
this.updateProactiveRefresh();
|
|
@@ -7054,7 +7046,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7054
7046
|
this.updateProactiveRefresh();
|
|
7055
7047
|
};
|
|
7056
7048
|
AuthInterop.prototype.assertAuthConfigured = function () {
|
|
7057
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7049
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7058
7050
|
};
|
|
7059
7051
|
AuthInterop.prototype.updateProactiveRefresh = function () {
|
|
7060
7052
|
if (this.internalListeners.size > 0) {
|
|
@@ -7085,13 +7077,13 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7085
7077
|
*/
|
|
7086
7078
|
function getVersionForPlatform(clientPlatform) {
|
|
7087
7079
|
switch (clientPlatform) {
|
|
7088
|
-
case "Node" /* NODE */:
|
|
7080
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
7089
7081
|
return 'node';
|
|
7090
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
7082
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
7091
7083
|
return 'rn';
|
|
7092
|
-
case "Worker" /* WORKER */:
|
|
7084
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
7093
7085
|
return 'webworker';
|
|
7094
|
-
case "Cordova" /* CORDOVA */:
|
|
7086
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
7095
7087
|
return 'cordova';
|
|
7096
7088
|
default:
|
|
7097
7089
|
return undefined;
|
|
@@ -7099,48 +7091,48 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
7099
7091
|
}
|
|
7100
7092
|
/** @internal */
|
|
7101
7093
|
function registerAuth(clientPlatform) {
|
|
7102
|
-
app._registerComponent(new component.Component("auth" /* AUTH */, function (container, _a) {
|
|
7094
|
+
app._registerComponent(new component.Component("auth" /* _ComponentName.AUTH */, function (container, _a) {
|
|
7103
7095
|
var deps = _a.options;
|
|
7104
7096
|
var app = container.getProvider('app').getImmediate();
|
|
7105
7097
|
var heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
7106
7098
|
var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
|
|
7107
7099
|
return (function (app, heartbeatServiceProvider) {
|
|
7108
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
7100
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
7109
7101
|
// Auth domain is optional if IdP sign in isn't being used
|
|
7110
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
7102
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
7111
7103
|
appName: app.name
|
|
7112
7104
|
});
|
|
7113
7105
|
var config = {
|
|
7114
7106
|
apiKey: apiKey,
|
|
7115
7107
|
authDomain: authDomain,
|
|
7116
7108
|
clientPlatform: clientPlatform,
|
|
7117
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
7118
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
7119
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
7109
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
7110
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
7111
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
7120
7112
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
7121
7113
|
};
|
|
7122
7114
|
var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
7123
7115
|
_initializeAuthInstance(authInstance, deps);
|
|
7124
7116
|
return authInstance;
|
|
7125
7117
|
})(app, heartbeatServiceProvider);
|
|
7126
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
7118
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
7127
7119
|
/**
|
|
7128
7120
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
7129
7121
|
* For why we do this, See go/firebase-next-auth-init
|
|
7130
7122
|
*/
|
|
7131
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
7123
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
7132
7124
|
/**
|
|
7133
7125
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
7134
7126
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
7135
7127
|
*/
|
|
7136
7128
|
.setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {
|
|
7137
|
-
var authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
7129
|
+
var authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
7138
7130
|
authInternalProvider.initialize();
|
|
7139
7131
|
}));
|
|
7140
|
-
app._registerComponent(new component.Component("auth-internal" /* AUTH_INTERNAL */, function (container) {
|
|
7141
|
-
var auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
7132
|
+
app._registerComponent(new component.Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, function (container) {
|
|
7133
|
+
var auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
7142
7134
|
return (function (auth) { return new AuthInterop(auth); })(auth);
|
|
7143
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
7135
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
7144
7136
|
app.registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
7145
7137
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
7146
7138
|
app.registerVersion(name, version, 'cjs5');
|
|
@@ -7263,10 +7255,10 @@ var ActionCodeOperation = {
|
|
|
7263
7255
|
* limitations under the License.
|
|
7264
7256
|
*/
|
|
7265
7257
|
function startSignInPhoneMfa(auth, request) {
|
|
7266
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:start" /* START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7258
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:start" /* Endpoint.START_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7267
7259
|
}
|
|
7268
7260
|
function finalizeSignInPhoneMfa(auth, request) {
|
|
7269
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaSignIn:finalize" /* FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7261
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaSignIn:finalize" /* Endpoint.FINALIZE_MFA_SIGN_IN */, _addTidIfNecessary(auth, request));
|
|
7270
7262
|
}
|
|
7271
7263
|
|
|
7272
7264
|
/**
|
|
@@ -7289,7 +7281,7 @@ function getRecaptchaParams(auth) {
|
|
|
7289
7281
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
7290
7282
|
return tslib.__generator(this, function (_a) {
|
|
7291
7283
|
switch (_a.label) {
|
|
7292
|
-
case 0: return [4 /*yield*/, _performApiRequest(auth, "GET" /* GET */, "/v1/recaptchaParams" /* GET_RECAPTCHA_PARAM */)];
|
|
7284
|
+
case 0: return [4 /*yield*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/recaptchaParams" /* Endpoint.GET_RECAPTCHA_PARAM */)];
|
|
7293
7285
|
case 1: return [2 /*return*/, ((_a.sent()).recaptchaSiteKey || '')];
|
|
7294
7286
|
}
|
|
7295
7287
|
});
|
|
@@ -7402,7 +7394,7 @@ function _loadJS(url) {
|
|
|
7402
7394
|
el.setAttribute('src', url);
|
|
7403
7395
|
el.onload = resolve;
|
|
7404
7396
|
el.onerror = function (e) {
|
|
7405
|
-
var error = _createError("internal-error" /* INTERNAL_ERROR */);
|
|
7397
|
+
var error = _createError("internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7406
7398
|
error.customData = e;
|
|
7407
7399
|
reject(error);
|
|
7408
7400
|
};
|
|
@@ -7412,7 +7404,7 @@ function _loadJS(url) {
|
|
|
7412
7404
|
});
|
|
7413
7405
|
}
|
|
7414
7406
|
function _generateCallbackName(prefix) {
|
|
7415
|
-
return "__"
|
|
7407
|
+
return "__".concat(prefix).concat(Math.floor(Math.random() * 1000000));
|
|
7416
7408
|
}
|
|
7417
7409
|
|
|
7418
7410
|
/**
|
|
@@ -7483,7 +7475,7 @@ var MockWidget = /** @class */ (function () {
|
|
|
7483
7475
|
var container = typeof containerOrId === 'string'
|
|
7484
7476
|
? document.getElementById(containerOrId)
|
|
7485
7477
|
: containerOrId;
|
|
7486
|
-
_assert(container, "argument-error" /* ARGUMENT_ERROR */, { appName: appName });
|
|
7478
|
+
_assert(container, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, { appName: appName });
|
|
7487
7479
|
this.container = container;
|
|
7488
7480
|
this.isVisible = this.params.size !== 'invisible';
|
|
7489
7481
|
if (this.isVisible) {
|
|
@@ -7591,20 +7583,20 @@ var ReCaptchaLoaderImpl = /** @class */ (function () {
|
|
|
7591
7583
|
ReCaptchaLoaderImpl.prototype.load = function (auth, hl) {
|
|
7592
7584
|
var _this = this;
|
|
7593
7585
|
if (hl === void 0) { hl = ''; }
|
|
7594
|
-
_assert(isHostLanguageValid(hl), auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7586
|
+
_assert(isHostLanguageValid(hl), auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7595
7587
|
if (this.shouldResolveImmediately(hl)) {
|
|
7596
7588
|
return Promise.resolve(_window().grecaptcha);
|
|
7597
7589
|
}
|
|
7598
7590
|
return new Promise(function (resolve, reject) {
|
|
7599
7591
|
var networkTimeout = _window().setTimeout(function () {
|
|
7600
|
-
reject(_createError(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
7592
|
+
reject(_createError(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
7601
7593
|
}, NETWORK_TIMEOUT_DELAY.get());
|
|
7602
7594
|
_window()[_JSLOAD_CALLBACK] = function () {
|
|
7603
7595
|
_window().clearTimeout(networkTimeout);
|
|
7604
7596
|
delete _window()[_JSLOAD_CALLBACK];
|
|
7605
7597
|
var recaptcha = _window().grecaptcha;
|
|
7606
7598
|
if (!recaptcha) {
|
|
7607
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
7599
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
7608
7600
|
return;
|
|
7609
7601
|
}
|
|
7610
7602
|
// Wrap the greptcha render function so that we know if the developer has
|
|
@@ -7618,14 +7610,14 @@ var ReCaptchaLoaderImpl = /** @class */ (function () {
|
|
|
7618
7610
|
_this.hostLanguage = hl;
|
|
7619
7611
|
resolve(recaptcha);
|
|
7620
7612
|
};
|
|
7621
|
-
var url = RECAPTCHA_BASE
|
|
7613
|
+
var url = "".concat(RECAPTCHA_BASE, "?").concat(util.querystring({
|
|
7622
7614
|
onload: _JSLOAD_CALLBACK,
|
|
7623
7615
|
render: 'explicit',
|
|
7624
7616
|
hl: hl
|
|
7625
|
-
});
|
|
7617
|
+
}));
|
|
7626
7618
|
_loadJS(url).catch(function () {
|
|
7627
7619
|
clearTimeout(networkTimeout);
|
|
7628
|
-
reject(_createError(auth, "internal-error" /* INTERNAL_ERROR */));
|
|
7620
|
+
reject(_createError(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */));
|
|
7629
7621
|
});
|
|
7630
7622
|
});
|
|
7631
7623
|
};
|
|
@@ -7729,11 +7721,11 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7729
7721
|
this.recaptcha = null;
|
|
7730
7722
|
this.auth = _castAuth(authExtern);
|
|
7731
7723
|
this.isInvisible = this.parameters.size === 'invisible';
|
|
7732
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
7724
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
7733
7725
|
var container = typeof containerOrId === 'string'
|
|
7734
7726
|
? document.getElementById(containerOrId)
|
|
7735
7727
|
: containerOrId;
|
|
7736
|
-
_assert(container, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7728
|
+
_assert(container, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7737
7729
|
this.container = container;
|
|
7738
7730
|
this.parameters.callback = this.makeTokenCallback(this.parameters.callback);
|
|
7739
7731
|
this._recaptchaLoader = this.auth.settings.appVerificationDisabledForTesting
|
|
@@ -7827,9 +7819,9 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7827
7819
|
}
|
|
7828
7820
|
};
|
|
7829
7821
|
RecaptchaVerifier.prototype.validateStartingState = function () {
|
|
7830
|
-
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7831
|
-
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
7832
|
-
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
7822
|
+
_assert(!this.parameters.sitekey, this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7823
|
+
_assert(this.isInvisible || !this.container.hasChildNodes(), this.auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7824
|
+
_assert(typeof document !== 'undefined', this.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
7833
7825
|
};
|
|
7834
7826
|
RecaptchaVerifier.prototype.makeTokenCallback = function (existing) {
|
|
7835
7827
|
var _this = this;
|
|
@@ -7847,7 +7839,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7847
7839
|
};
|
|
7848
7840
|
};
|
|
7849
7841
|
RecaptchaVerifier.prototype.assertNotDestroyed = function () {
|
|
7850
|
-
_assert(!this.destroyed, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7842
|
+
_assert(!this.destroyed, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7851
7843
|
};
|
|
7852
7844
|
RecaptchaVerifier.prototype.makeRenderPromise = function () {
|
|
7853
7845
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
@@ -7877,7 +7869,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7877
7869
|
return tslib.__generator(this, function (_b) {
|
|
7878
7870
|
switch (_b.label) {
|
|
7879
7871
|
case 0:
|
|
7880
|
-
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7872
|
+
_assert(_isHttpOrHttps() && !_isWorker(), this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7881
7873
|
return [4 /*yield*/, domReady()];
|
|
7882
7874
|
case 1:
|
|
7883
7875
|
_b.sent();
|
|
@@ -7888,7 +7880,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7888
7880
|
return [4 /*yield*/, getRecaptchaParams(this.auth)];
|
|
7889
7881
|
case 3:
|
|
7890
7882
|
siteKey = _b.sent();
|
|
7891
|
-
_assert(siteKey, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7883
|
+
_assert(siteKey, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7892
7884
|
this.parameters.sitekey = siteKey;
|
|
7893
7885
|
return [2 /*return*/];
|
|
7894
7886
|
}
|
|
@@ -7896,7 +7888,7 @@ var RecaptchaVerifier = /** @class */ (function () {
|
|
|
7896
7888
|
});
|
|
7897
7889
|
};
|
|
7898
7890
|
RecaptchaVerifier.prototype.getAssertedRecaptcha = function () {
|
|
7899
|
-
_assert(this.recaptcha, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7891
|
+
_assert(this.recaptcha, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7900
7892
|
return this.recaptcha;
|
|
7901
7893
|
};
|
|
7902
7894
|
return RecaptchaVerifier;
|
|
@@ -8011,7 +8003,7 @@ function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
|
8011
8003
|
switch (_a.label) {
|
|
8012
8004
|
case 0:
|
|
8013
8005
|
userInternal = util.getModularInstance(user);
|
|
8014
|
-
return [4 /*yield*/, _assertLinkedStatus(false, userInternal, "phone" /* PHONE */)];
|
|
8006
|
+
return [4 /*yield*/, _assertLinkedStatus(false, userInternal, "phone" /* ProviderId.PHONE */)];
|
|
8015
8007
|
case 1:
|
|
8016
8008
|
_a.sent();
|
|
8017
8009
|
return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, util.getModularInstance(appVerifier))];
|
|
@@ -8068,8 +8060,8 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
8068
8060
|
_b.label = 2;
|
|
8069
8061
|
case 2:
|
|
8070
8062
|
_b.trys.push([2, , 10, 11]);
|
|
8071
|
-
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8072
|
-
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8063
|
+
_assert(typeof recaptchaToken === 'string', auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8064
|
+
_assert(verifier.type === RECAPTCHA_VERIFIER_TYPE, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8073
8065
|
phoneInfoOptions = void 0;
|
|
8074
8066
|
if (typeof options === 'string') {
|
|
8075
8067
|
phoneInfoOptions = {
|
|
@@ -8082,7 +8074,7 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
8082
8074
|
if (!('session' in phoneInfoOptions)) return [3 /*break*/, 7];
|
|
8083
8075
|
session = phoneInfoOptions.session;
|
|
8084
8076
|
if (!('phoneNumber' in phoneInfoOptions)) return [3 /*break*/, 4];
|
|
8085
|
-
_assert(session.type === "enroll" /* ENROLL */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8077
|
+
_assert(session.type === "enroll" /* MultiFactorSessionType.ENROLL */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8086
8078
|
return [4 /*yield*/, startEnrollPhoneMfa(auth, {
|
|
8087
8079
|
idToken: session.credential,
|
|
8088
8080
|
phoneEnrollmentInfo: {
|
|
@@ -8094,10 +8086,10 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
8094
8086
|
response = _b.sent();
|
|
8095
8087
|
return [2 /*return*/, response.phoneSessionInfo.sessionInfo];
|
|
8096
8088
|
case 4:
|
|
8097
|
-
_assert(session.type === "signin" /* SIGN_IN */, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8089
|
+
_assert(session.type === "signin" /* MultiFactorSessionType.SIGN_IN */, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8098
8090
|
mfaEnrollmentId = ((_a = phoneInfoOptions.multiFactorHint) === null || _a === void 0 ? void 0 : _a.uid) ||
|
|
8099
8091
|
phoneInfoOptions.multiFactorUid;
|
|
8100
|
-
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* MISSING_MFA_INFO */);
|
|
8092
|
+
_assert(mfaEnrollmentId, auth, "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */);
|
|
8101
8093
|
return [4 /*yield*/, startSignInPhoneMfa(auth, {
|
|
8102
8094
|
mfaPendingCredential: session.credential,
|
|
8103
8095
|
mfaEnrollmentId: mfaEnrollmentId,
|
|
@@ -8318,9 +8310,9 @@ var PhoneAuthProvider = /** @class */ (function () {
|
|
|
8318
8310
|
return null;
|
|
8319
8311
|
};
|
|
8320
8312
|
/** Always set to {@link ProviderId}.PHONE. */
|
|
8321
|
-
PhoneAuthProvider.PROVIDER_ID = "phone" /* PHONE */;
|
|
8313
|
+
PhoneAuthProvider.PROVIDER_ID = "phone" /* ProviderId.PHONE */;
|
|
8322
8314
|
/** Always set to {@link SignInMethod}.PHONE. */
|
|
8323
|
-
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* PHONE */;
|
|
8315
|
+
PhoneAuthProvider.PHONE_SIGN_IN_METHOD = "phone" /* SignInMethod.PHONE */;
|
|
8324
8316
|
return PhoneAuthProvider;
|
|
8325
8317
|
}());
|
|
8326
8318
|
|
|
@@ -8330,9 +8322,9 @@ var MultiFactorAssertionImpl = /** @class */ (function () {
|
|
|
8330
8322
|
}
|
|
8331
8323
|
MultiFactorAssertionImpl.prototype._process = function (auth, session, displayName) {
|
|
8332
8324
|
switch (session.type) {
|
|
8333
|
-
case "enroll" /* ENROLL */:
|
|
8325
|
+
case "enroll" /* MultiFactorSessionType.ENROLL */:
|
|
8334
8326
|
return this._finalizeEnroll(auth, session.credential, displayName);
|
|
8335
|
-
case "signin" /* SIGN_IN */:
|
|
8327
|
+
case "signin" /* MultiFactorSessionType.SIGN_IN */:
|
|
8336
8328
|
return this._finalizeSignIn(auth, session.credential);
|
|
8337
8329
|
default:
|
|
8338
8330
|
return debugFail('unexpected MultiFactorSessionType');
|
|
@@ -8349,7 +8341,7 @@ var MultiFactorAssertionImpl = /** @class */ (function () {
|
|
|
8349
8341
|
var PhoneMultiFactorAssertionImpl = /** @class */ (function (_super) {
|
|
8350
8342
|
tslib.__extends(PhoneMultiFactorAssertionImpl, _super);
|
|
8351
8343
|
function PhoneMultiFactorAssertionImpl(credential) {
|
|
8352
|
-
var _this = _super.call(this, "phone" /* PHONE */) || this;
|
|
8344
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */) || this;
|
|
8353
8345
|
_this.credential = credential;
|
|
8354
8346
|
return _this;
|
|
8355
8347
|
}
|
|
@@ -8510,4 +8502,4 @@ exports.updateProfile = updateProfile;
|
|
|
8510
8502
|
exports.useDeviceLanguage = useDeviceLanguage;
|
|
8511
8503
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
8512
8504
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
8513
|
-
//# sourceMappingURL=phone-
|
|
8505
|
+
//# sourceMappingURL=phone-bc99e0b0.js.map
|