@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
|
@@ -127,7 +127,7 @@ var Receiver = /** @class */ (function () {
|
|
|
127
127
|
return [2 /*return*/];
|
|
128
128
|
}
|
|
129
129
|
messageEvent.ports[0].postMessage({
|
|
130
|
-
status: "ack" /* ACK */,
|
|
130
|
+
status: "ack" /* _Status.ACK */,
|
|
131
131
|
eventId: eventId,
|
|
132
132
|
eventType: eventType
|
|
133
133
|
});
|
|
@@ -138,7 +138,7 @@ var Receiver = /** @class */ (function () {
|
|
|
138
138
|
case 1:
|
|
139
139
|
response = _b.sent();
|
|
140
140
|
messageEvent.ports[0].postMessage({
|
|
141
|
-
status: "done" /* DONE */,
|
|
141
|
+
status: "done" /* _Status.DONE */,
|
|
142
142
|
eventId: eventId,
|
|
143
143
|
eventType: eventType,
|
|
144
144
|
response: response
|
|
@@ -263,20 +263,20 @@ var Sender = /** @class */ (function () {
|
|
|
263
263
|
* @returns An array of settled promises from all the handlers that were listening on the receiver.
|
|
264
264
|
*/
|
|
265
265
|
Sender.prototype._send = function (eventType, data, timeout) {
|
|
266
|
-
if (timeout === void 0) { timeout = 50 /* ACK */; }
|
|
266
|
+
if (timeout === void 0) { timeout = 50 /* _TimeoutDuration.ACK */; }
|
|
267
267
|
return __awaiter(this, void 0, void 0, function () {
|
|
268
268
|
var messageChannel, completionTimer, handler;
|
|
269
269
|
var _this = this;
|
|
270
270
|
return __generator(this, function (_a) {
|
|
271
271
|
messageChannel = typeof MessageChannel !== 'undefined' ? new MessageChannel() : null;
|
|
272
272
|
if (!messageChannel) {
|
|
273
|
-
throw new Error("connection_unavailable" /* CONNECTION_UNAVAILABLE */);
|
|
273
|
+
throw new Error("connection_unavailable" /* _MessageError.CONNECTION_UNAVAILABLE */);
|
|
274
274
|
}
|
|
275
275
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
276
276
|
var eventId = _generateEventId('', 20);
|
|
277
277
|
messageChannel.port1.start();
|
|
278
278
|
var ackTimer = setTimeout(function () {
|
|
279
|
-
reject(new Error("unsupported_event" /* UNSUPPORTED_EVENT */));
|
|
279
|
+
reject(new Error("unsupported_event" /* _MessageError.UNSUPPORTED_EVENT */));
|
|
280
280
|
}, timeout);
|
|
281
281
|
handler = {
|
|
282
282
|
messageChannel: messageChannel,
|
|
@@ -286,14 +286,14 @@ var Sender = /** @class */ (function () {
|
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
288
|
switch (messageEvent.data.status) {
|
|
289
|
-
case "ack" /* ACK */:
|
|
289
|
+
case "ack" /* _Status.ACK */:
|
|
290
290
|
// The receiver should ACK first.
|
|
291
291
|
clearTimeout(ackTimer);
|
|
292
292
|
completionTimer = setTimeout(function () {
|
|
293
|
-
reject(new Error("timeout" /* TIMEOUT */));
|
|
294
|
-
}, 3000 /* COMPLETION */);
|
|
293
|
+
reject(new Error("timeout" /* _MessageError.TIMEOUT */));
|
|
294
|
+
}, 3000 /* _TimeoutDuration.COMPLETION */);
|
|
295
295
|
break;
|
|
296
|
-
case "done" /* DONE */:
|
|
296
|
+
case "done" /* _Status.DONE */:
|
|
297
297
|
// Once the receiver's handlers are finished we will get the results.
|
|
298
298
|
clearTimeout(completionTimer);
|
|
299
299
|
resolve(messageEvent.data.response);
|
|
@@ -301,7 +301,7 @@ var Sender = /** @class */ (function () {
|
|
|
301
301
|
default:
|
|
302
302
|
clearTimeout(ackTimer);
|
|
303
303
|
clearTimeout(completionTimer);
|
|
304
|
-
reject(new Error("invalid_response" /* INVALID_RESPONSE */));
|
|
304
|
+
reject(new Error("invalid_response" /* _MessageError.INVALID_RESPONSE */));
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
}
|
|
@@ -533,7 +533,7 @@ var _POLLING_INTERVAL_MS$1 = 800;
|
|
|
533
533
|
var _TRANSACTION_RETRY_COUNT = 3;
|
|
534
534
|
var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
535
535
|
function IndexedDBLocalPersistence() {
|
|
536
|
-
this.type = "LOCAL" /* LOCAL */;
|
|
536
|
+
this.type = "LOCAL" /* PersistenceType.LOCAL */;
|
|
537
537
|
this._shouldAllowMigration = true;
|
|
538
538
|
this.listeners = {};
|
|
539
539
|
this.localCache = {};
|
|
@@ -620,7 +620,7 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
620
620
|
return __generator(this, function (_a) {
|
|
621
621
|
this.receiver = Receiver._getInstance(_getWorkerGlobalScope());
|
|
622
622
|
// Refresh from persistence if we receive a KeyChanged message.
|
|
623
|
-
this.receiver._subscribe("keyChanged" /* KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
623
|
+
this.receiver._subscribe("keyChanged" /* _EventType.KEY_CHANGED */, function (_origin, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
624
624
|
var keys;
|
|
625
625
|
return __generator(this, function (_a) {
|
|
626
626
|
switch (_a.label) {
|
|
@@ -634,9 +634,9 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
634
634
|
});
|
|
635
635
|
}); });
|
|
636
636
|
// Let the sender know that we are listening so they give us more timeout.
|
|
637
|
-
this.receiver._subscribe("ping" /* PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
637
|
+
this.receiver._subscribe("ping" /* _EventType.PING */, function (_origin, _data) { return __awaiter(_this, void 0, void 0, function () {
|
|
638
638
|
return __generator(this, function (_a) {
|
|
639
|
-
return [2 /*return*/, ["keyChanged" /* KEY_CHANGED */]];
|
|
639
|
+
return [2 /*return*/, ["keyChanged" /* _EventType.KEY_CHANGED */]];
|
|
640
640
|
});
|
|
641
641
|
}); });
|
|
642
642
|
return [2 /*return*/];
|
|
@@ -667,14 +667,14 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
667
667
|
return [2 /*return*/];
|
|
668
668
|
}
|
|
669
669
|
this.sender = new Sender(this.activeServiceWorker);
|
|
670
|
-
return [4 /*yield*/, this.sender._send("ping" /* PING */, {}, 800 /* LONG_ACK */)];
|
|
670
|
+
return [4 /*yield*/, this.sender._send("ping" /* _EventType.PING */, {}, 800 /* _TimeoutDuration.LONG_ACK */)];
|
|
671
671
|
case 2:
|
|
672
672
|
results = _d.sent();
|
|
673
673
|
if (!results) {
|
|
674
674
|
return [2 /*return*/];
|
|
675
675
|
}
|
|
676
676
|
if (((_a = results[0]) === null || _a === void 0 ? void 0 : _a.fulfilled) &&
|
|
677
|
-
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* KEY_CHANGED */))) {
|
|
677
|
+
((_b = results[0]) === null || _b === void 0 ? void 0 : _b.value.includes("keyChanged" /* _EventType.KEY_CHANGED */))) {
|
|
678
678
|
this.serviceWorkerReceiverAvailable = true;
|
|
679
679
|
}
|
|
680
680
|
return [2 /*return*/];
|
|
@@ -704,11 +704,11 @@ var IndexedDBLocalPersistence = /** @class */ (function () {
|
|
|
704
704
|
_b.label = 1;
|
|
705
705
|
case 1:
|
|
706
706
|
_b.trys.push([1, 3, , 4]);
|
|
707
|
-
return [4 /*yield*/, this.sender._send("keyChanged" /* KEY_CHANGED */, { key: key },
|
|
707
|
+
return [4 /*yield*/, this.sender._send("keyChanged" /* _EventType.KEY_CHANGED */, { key: key },
|
|
708
708
|
// Use long timeout if receiver has previously responded to a ping from us.
|
|
709
709
|
this.serviceWorkerReceiverAvailable
|
|
710
|
-
? 800 /* LONG_ACK */
|
|
711
|
-
: 50 /* ACK */)];
|
|
710
|
+
? 800 /* _TimeoutDuration.LONG_ACK */
|
|
711
|
+
: 50 /* _TimeoutDuration.ACK */)];
|
|
712
712
|
case 2:
|
|
713
713
|
_b.sent();
|
|
714
714
|
return [3 /*break*/, 4];
|
|
@@ -937,147 +937,147 @@ var indexedDBLocalPersistence = IndexedDBLocalPersistence;
|
|
|
937
937
|
function _debugErrorMap() {
|
|
938
938
|
var _a;
|
|
939
939
|
return _a = {},
|
|
940
|
-
_a["admin-restricted-operation" /* ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
941
|
-
_a["argument-error" /* ARGUMENT_ERROR */] = '',
|
|
942
|
-
_a["app-not-authorized" /* APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
940
|
+
_a["admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */] = 'This operation is restricted to administrators only.',
|
|
941
|
+
_a["argument-error" /* AuthErrorCode.ARGUMENT_ERROR */] = '',
|
|
942
|
+
_a["app-not-authorized" /* AuthErrorCode.APP_NOT_AUTHORIZED */] = "This app, identified by the domain where it's hosted, is not " +
|
|
943
943
|
'authorized to use Firebase Authentication with the provided API key. ' +
|
|
944
944
|
'Review your key configuration in the Google API console.',
|
|
945
|
-
_a["app-not-installed" /* APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
945
|
+
_a["app-not-installed" /* AuthErrorCode.APP_NOT_INSTALLED */] = 'The requested mobile application corresponding to the identifier (' +
|
|
946
946
|
'Android package name or iOS bundle ID) provided is not installed on ' +
|
|
947
947
|
'this device.',
|
|
948
|
-
_a["captcha-check-failed" /* CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
948
|
+
_a["captcha-check-failed" /* AuthErrorCode.CAPTCHA_CHECK_FAILED */] = 'The reCAPTCHA response token provided is either invalid, expired, ' +
|
|
949
949
|
'already used or the domain associated with it does not match the list ' +
|
|
950
950
|
'of whitelisted domains.',
|
|
951
|
-
_a["code-expired" /* CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
951
|
+
_a["code-expired" /* AuthErrorCode.CODE_EXPIRED */] = 'The SMS code has expired. Please re-send the verification code to try ' +
|
|
952
952
|
'again.',
|
|
953
|
-
_a["cordova-not-ready" /* CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
954
|
-
_a["cors-unsupported" /* CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
955
|
-
_a["credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
956
|
-
_a["custom-token-mismatch" /* CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
957
|
-
_a["requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
953
|
+
_a["cordova-not-ready" /* AuthErrorCode.CORDOVA_NOT_READY */] = 'Cordova framework is not ready.',
|
|
954
|
+
_a["cors-unsupported" /* AuthErrorCode.CORS_UNSUPPORTED */] = 'This browser is not supported.',
|
|
955
|
+
_a["credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */] = 'This credential is already associated with a different user account.',
|
|
956
|
+
_a["custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */] = 'The custom token corresponds to a different audience.',
|
|
957
|
+
_a["requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = 'This operation is sensitive and requires recent authentication. Log in ' +
|
|
958
958
|
'again before retrying this request.',
|
|
959
|
-
_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 ' +
|
|
959
|
+
_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 ' +
|
|
960
960
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
961
961
|
'starting any other Firebase SDK.',
|
|
962
|
-
_a["dynamic-link-not-activated" /* DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
962
|
+
_a["dynamic-link-not-activated" /* AuthErrorCode.DYNAMIC_LINK_NOT_ACTIVATED */] = 'Please activate Dynamic Links in the Firebase Console and agree to the terms and ' +
|
|
963
963
|
'conditions.',
|
|
964
|
-
_a["email-change-needs-verification" /* EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
965
|
-
_a["email-already-in-use" /* EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
966
|
-
_a["emulator-config-failed" /* EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
964
|
+
_a["email-change-needs-verification" /* AuthErrorCode.EMAIL_CHANGE_NEEDS_VERIFICATION */] = 'Multi-factor users must always have a verified email.',
|
|
965
|
+
_a["email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */] = 'The email address is already in use by another account.',
|
|
966
|
+
_a["emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */] = 'Auth instance has already been used to make a network call. Auth can ' +
|
|
967
967
|
'no longer be configured to use the emulator. Try calling ' +
|
|
968
968
|
'"connectAuthEmulator()" sooner.',
|
|
969
|
-
_a["expired-action-code" /* EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
970
|
-
_a["cancelled-popup-request" /* EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
971
|
-
_a["internal-error" /* INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
972
|
-
_a["invalid-app-credential" /* INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
969
|
+
_a["expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */] = 'The action code has expired.',
|
|
970
|
+
_a["cancelled-popup-request" /* AuthErrorCode.EXPIRED_POPUP_REQUEST */] = 'This operation has been cancelled due to another conflicting popup being opened.',
|
|
971
|
+
_a["internal-error" /* AuthErrorCode.INTERNAL_ERROR */] = 'An internal AuthError has occurred.',
|
|
972
|
+
_a["invalid-app-credential" /* AuthErrorCode.INVALID_APP_CREDENTIAL */] = 'The phone verification request contains an invalid application verifier.' +
|
|
973
973
|
' The reCAPTCHA token response is either invalid or expired.',
|
|
974
|
-
_a["invalid-app-id" /* INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
975
|
-
_a["invalid-user-token" /* INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
974
|
+
_a["invalid-app-id" /* AuthErrorCode.INVALID_APP_ID */] = 'The mobile app identifier is not registed for the current project.',
|
|
975
|
+
_a["invalid-user-token" /* AuthErrorCode.INVALID_AUTH */] = "This user's credential isn't valid for this project. This can happen " +
|
|
976
976
|
"if the user's token has been tampered with, or if the user isn't for " +
|
|
977
977
|
'the project associated with this API key.',
|
|
978
|
-
_a["invalid-auth-event" /* INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
979
|
-
_a["invalid-verification-code" /* INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
978
|
+
_a["invalid-auth-event" /* AuthErrorCode.INVALID_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
979
|
+
_a["invalid-verification-code" /* AuthErrorCode.INVALID_CODE */] = 'The SMS verification code used to create the phone auth credential is ' +
|
|
980
980
|
'invalid. Please resend the verification code sms and be sure to use the ' +
|
|
981
981
|
'verification code provided by the user.',
|
|
982
|
-
_a["invalid-continue-uri" /* INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
983
|
-
_a["invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
982
|
+
_a["invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */] = 'The continue URL provided in the request is invalid.',
|
|
983
|
+
_a["invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */] = 'The following Cordova plugins must be installed to enable OAuth sign-in: ' +
|
|
984
984
|
'cordova-plugin-buildinfo, cordova-universal-links-plugin, ' +
|
|
985
985
|
'cordova-plugin-browsertab, cordova-plugin-inappbrowser and ' +
|
|
986
986
|
'cordova-plugin-customurlscheme.',
|
|
987
|
-
_a["invalid-custom-token" /* INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
988
|
-
_a["invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
989
|
-
_a["invalid-email" /* INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
990
|
-
_a["invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
991
|
-
_a["invalid-api-key" /* INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
992
|
-
_a["invalid-cert-hash" /* INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
993
|
-
_a["invalid-credential" /* INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
994
|
-
_a["invalid-message-payload" /* INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
987
|
+
_a["invalid-custom-token" /* AuthErrorCode.INVALID_CUSTOM_TOKEN */] = 'The custom token format is incorrect. Please check the documentation.',
|
|
988
|
+
_a["invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */] = 'The provided dynamic link domain is not configured or authorized for the current project.',
|
|
989
|
+
_a["invalid-email" /* AuthErrorCode.INVALID_EMAIL */] = 'The email address is badly formatted.',
|
|
990
|
+
_a["invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */] = 'Emulator URL must start with a valid scheme (http:// or https://).',
|
|
991
|
+
_a["invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */] = 'Your API key is invalid, please check you have copied it correctly.',
|
|
992
|
+
_a["invalid-cert-hash" /* AuthErrorCode.INVALID_CERT_HASH */] = 'The SHA-1 certificate hash provided is invalid.',
|
|
993
|
+
_a["invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */] = 'The supplied auth credential is malformed or has expired.',
|
|
994
|
+
_a["invalid-message-payload" /* AuthErrorCode.INVALID_MESSAGE_PAYLOAD */] = 'The email template corresponding to this action contains invalid characters in its message. ' +
|
|
995
995
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
996
|
-
_a["invalid-multi-factor-session" /* INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
997
|
-
_a["invalid-oauth-provider" /* INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
996
|
+
_a["invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */] = 'The request does not contain a valid proof of first factor successful sign-in.',
|
|
997
|
+
_a["invalid-oauth-provider" /* AuthErrorCode.INVALID_OAUTH_PROVIDER */] = 'EmailAuthProvider is not supported for this operation. This operation ' +
|
|
998
998
|
'only supports OAuth providers.',
|
|
999
|
-
_a["invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
999
|
+
_a["invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */] = 'The OAuth client ID provided is either invalid or does not match the ' +
|
|
1000
1000
|
'specified API key.',
|
|
1001
|
-
_a["unauthorized-domain" /* INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
1001
|
+
_a["unauthorized-domain" /* AuthErrorCode.INVALID_ORIGIN */] = 'This domain is not authorized for OAuth operations for your Firebase ' +
|
|
1002
1002
|
'project. Edit the list of authorized domains from the Firebase console.',
|
|
1003
|
-
_a["invalid-action-code" /* INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
1003
|
+
_a["invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */] = 'The action code is invalid. This can happen if the code is malformed, ' +
|
|
1004
1004
|
'expired, or has already been used.',
|
|
1005
|
-
_a["wrong-password" /* INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
1006
|
-
_a["invalid-persistence-type" /* INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
1007
|
-
_a["invalid-phone-number" /* INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
1005
|
+
_a["wrong-password" /* AuthErrorCode.INVALID_PASSWORD */] = 'The password is invalid or the user does not have a password.',
|
|
1006
|
+
_a["invalid-persistence-type" /* AuthErrorCode.INVALID_PERSISTENCE */] = 'The specified persistence type is invalid. It can only be local, session or none.',
|
|
1007
|
+
_a["invalid-phone-number" /* AuthErrorCode.INVALID_PHONE_NUMBER */] = 'The format of the phone number provided is incorrect. Please enter the ' +
|
|
1008
1008
|
'phone number in a format that can be parsed into E.164 format. E.164 ' +
|
|
1009
1009
|
'phone numbers are written in the format [+][country code][subscriber ' +
|
|
1010
1010
|
'number including area code].',
|
|
1011
|
-
_a["invalid-provider-id" /* INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
1012
|
-
_a["invalid-recipient-email" /* INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
1011
|
+
_a["invalid-provider-id" /* AuthErrorCode.INVALID_PROVIDER_ID */] = 'The specified provider ID is invalid.',
|
|
1012
|
+
_a["invalid-recipient-email" /* AuthErrorCode.INVALID_RECIPIENT_EMAIL */] = 'The email corresponding to this action failed to send as the provided ' +
|
|
1013
1013
|
'recipient email address is invalid.',
|
|
1014
|
-
_a["invalid-sender" /* INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
1014
|
+
_a["invalid-sender" /* AuthErrorCode.INVALID_SENDER */] = 'The email template corresponding to this action contains an invalid sender email or name. ' +
|
|
1015
1015
|
'Please fix by going to the Auth email templates section in the Firebase Console.',
|
|
1016
|
-
_a["invalid-verification-id" /* INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
1017
|
-
_a["invalid-tenant-id" /* INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
1018
|
-
_a["login-blocked" /* LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
1019
|
-
_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.',
|
|
1020
|
-
_a["auth-domain-config-required" /* MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
1016
|
+
_a["invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */] = 'The verification ID used to create the phone auth credential is invalid.',
|
|
1017
|
+
_a["invalid-tenant-id" /* AuthErrorCode.INVALID_TENANT_ID */] = "The Auth instance's tenant ID is invalid.",
|
|
1018
|
+
_a["login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */] = 'Login blocked by user-provided method: {$originalMessage}',
|
|
1019
|
+
_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.',
|
|
1020
|
+
_a["auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */] = 'Be sure to include authDomain when calling firebase.initializeApp(), ' +
|
|
1021
1021
|
'by following the instructions in the Firebase console.',
|
|
1022
|
-
_a["missing-app-credential" /* MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
1022
|
+
_a["missing-app-credential" /* AuthErrorCode.MISSING_APP_CREDENTIAL */] = 'The phone verification request is missing an application verifier ' +
|
|
1023
1023
|
'assertion. A reCAPTCHA response token needs to be provided.',
|
|
1024
|
-
_a["missing-verification-code" /* MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
1025
|
-
_a["missing-continue-uri" /* MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
1026
|
-
_a["missing-iframe-start" /* MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
1027
|
-
_a["missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
1028
|
-
_a["missing-or-invalid-nonce" /* MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
1024
|
+
_a["missing-verification-code" /* AuthErrorCode.MISSING_CODE */] = 'The phone auth credential was created with an empty SMS verification code.',
|
|
1025
|
+
_a["missing-continue-uri" /* AuthErrorCode.MISSING_CONTINUE_URI */] = 'A continue URL must be provided in the request.',
|
|
1026
|
+
_a["missing-iframe-start" /* AuthErrorCode.MISSING_IFRAME_START */] = 'An internal AuthError has occurred.',
|
|
1027
|
+
_a["missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */] = 'An iOS Bundle ID must be provided if an App Store ID is provided.',
|
|
1028
|
+
_a["missing-or-invalid-nonce" /* AuthErrorCode.MISSING_OR_INVALID_NONCE */] = 'The request does not contain a valid nonce. This can occur if the ' +
|
|
1029
1029
|
'SHA-256 hash of the provided raw nonce does not match the hashed nonce ' +
|
|
1030
1030
|
'in the ID token payload.',
|
|
1031
|
-
_a["missing-multi-factor-info" /* MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
1032
|
-
_a["missing-multi-factor-session" /* MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
1033
|
-
_a["missing-phone-number" /* MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
1034
|
-
_a["missing-verification-id" /* MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
1035
|
-
_a["app-deleted" /* MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
1036
|
-
_a["multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
1037
|
-
_a["multi-factor-auth-required" /* MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
1038
|
-
_a["account-exists-with-different-credential" /* NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
1031
|
+
_a["missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */] = 'No second factor identifier is provided.',
|
|
1032
|
+
_a["missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */] = 'The request is missing proof of first factor successful sign-in.',
|
|
1033
|
+
_a["missing-phone-number" /* AuthErrorCode.MISSING_PHONE_NUMBER */] = 'To send verification codes, provide a phone number for the recipient.',
|
|
1034
|
+
_a["missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */] = 'The phone auth credential was created with an empty verification ID.',
|
|
1035
|
+
_a["app-deleted" /* AuthErrorCode.MODULE_DESTROYED */] = 'This instance of FirebaseApp has been deleted.',
|
|
1036
|
+
_a["multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */] = 'The user does not have a second factor matching the identifier provided.',
|
|
1037
|
+
_a["multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */] = 'Proof of ownership of a second factor is required to complete sign-in.',
|
|
1038
|
+
_a["account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */] = 'An account already exists with the same email address but different ' +
|
|
1039
1039
|
'sign-in credentials. Sign in using a provider associated with this ' +
|
|
1040
1040
|
'email address.',
|
|
1041
|
-
_a["network-request-failed" /* NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
1042
|
-
_a["no-auth-event" /* NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
1043
|
-
_a["no-such-provider" /* NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
1044
|
-
_a["null-user" /* NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
1041
|
+
_a["network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */] = 'A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.',
|
|
1042
|
+
_a["no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */] = 'An internal AuthError has occurred.',
|
|
1043
|
+
_a["no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */] = 'User was not linked to an account with the given provider.',
|
|
1044
|
+
_a["null-user" /* AuthErrorCode.NULL_USER */] = 'A null user object was provided as the argument for an operation which ' +
|
|
1045
1045
|
'requires a non-null user object.',
|
|
1046
|
-
_a["operation-not-allowed" /* OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
1046
|
+
_a["operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */] = 'The given sign-in provider is disabled for this Firebase project. ' +
|
|
1047
1047
|
'Enable it in the Firebase console, under the sign-in method tab of the ' +
|
|
1048
1048
|
'Auth section.',
|
|
1049
|
-
_a["operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
1049
|
+
_a["operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */] = 'This operation is not supported in the environment this application is ' +
|
|
1050
1050
|
'running on. "location.protocol" must be http, https or chrome-extension' +
|
|
1051
1051
|
' and web storage must be enabled.',
|
|
1052
|
-
_a["popup-blocked" /* POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
1053
|
-
_a["popup-closed-by-user" /* POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
1054
|
-
_a["provider-already-linked" /* PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
1055
|
-
_a["quota-exceeded" /* QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
1056
|
-
_a["redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
1057
|
-
_a["redirect-operation-pending" /* REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
1058
|
-
_a["rejected-credential" /* REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
1059
|
-
_a["second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
1060
|
-
_a["maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
1061
|
-
_a["tenant-id-mismatch" /* TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
1062
|
-
_a["timeout" /* TIMEOUT */] = 'The operation has timed out.',
|
|
1063
|
-
_a["user-token-expired" /* TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
1064
|
-
_a["too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
1052
|
+
_a["popup-blocked" /* AuthErrorCode.POPUP_BLOCKED */] = 'Unable to establish a connection with the popup. It may have been blocked by the browser.',
|
|
1053
|
+
_a["popup-closed-by-user" /* AuthErrorCode.POPUP_CLOSED_BY_USER */] = 'The popup has been closed by the user before finalizing the operation.',
|
|
1054
|
+
_a["provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */] = 'User can only be linked to one identity for the given provider.',
|
|
1055
|
+
_a["quota-exceeded" /* AuthErrorCode.QUOTA_EXCEEDED */] = "The project's quota for this operation has been exceeded.",
|
|
1056
|
+
_a["redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */] = 'The redirect operation has been cancelled by the user before finalizing.',
|
|
1057
|
+
_a["redirect-operation-pending" /* AuthErrorCode.REDIRECT_OPERATION_PENDING */] = 'A redirect sign-in operation is already pending.',
|
|
1058
|
+
_a["rejected-credential" /* AuthErrorCode.REJECTED_CREDENTIAL */] = 'The request contains malformed or mismatching credentials.',
|
|
1059
|
+
_a["second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */] = 'The second factor is already enrolled on this account.',
|
|
1060
|
+
_a["maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */] = 'The maximum allowed number of second factors on a user has been exceeded.',
|
|
1061
|
+
_a["tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */] = "The provided tenant ID does not match the Auth instance's tenant ID",
|
|
1062
|
+
_a["timeout" /* AuthErrorCode.TIMEOUT */] = 'The operation has timed out.',
|
|
1063
|
+
_a["user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */] = "The user's credential is no longer valid. The user must sign in again.",
|
|
1064
|
+
_a["too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */] = 'We have blocked all requests from this device due to unusual activity. ' +
|
|
1065
1065
|
'Try again later.',
|
|
1066
|
-
_a["unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
1066
|
+
_a["unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */] = 'The domain of the continue URL is not whitelisted. Please whitelist ' +
|
|
1067
1067
|
'the domain in the Firebase console.',
|
|
1068
|
-
_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.',
|
|
1069
|
-
_a["unsupported-persistence-type" /* UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
1070
|
-
_a["unsupported-tenant-operation" /* UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
1071
|
-
_a["unverified-email" /* UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
1072
|
-
_a["user-cancelled" /* USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
1073
|
-
_a["user-not-found" /* USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
1068
|
+
_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.',
|
|
1069
|
+
_a["unsupported-persistence-type" /* AuthErrorCode.UNSUPPORTED_PERSISTENCE */] = 'The current environment does not support the specified persistence type.',
|
|
1070
|
+
_a["unsupported-tenant-operation" /* AuthErrorCode.UNSUPPORTED_TENANT_OPERATION */] = 'This operation is not supported in a multi-tenant context.',
|
|
1071
|
+
_a["unverified-email" /* AuthErrorCode.UNVERIFIED_EMAIL */] = 'The operation requires a verified email.',
|
|
1072
|
+
_a["user-cancelled" /* AuthErrorCode.USER_CANCELLED */] = 'The user did not grant your application the permissions it requested.',
|
|
1073
|
+
_a["user-not-found" /* AuthErrorCode.USER_DELETED */] = 'There is no user record corresponding to this identifier. The user may ' +
|
|
1074
1074
|
'have been deleted.',
|
|
1075
|
-
_a["user-disabled" /* USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
1076
|
-
_a["user-mismatch" /* USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
1077
|
-
_a["user-signed-out" /* USER_SIGNED_OUT */] = '',
|
|
1078
|
-
_a["weak-password" /* WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
1079
|
-
_a["web-storage-unsupported" /* WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
1080
|
-
_a["already-initialized" /* ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
1075
|
+
_a["user-disabled" /* AuthErrorCode.USER_DISABLED */] = 'The user account has been disabled by an administrator.',
|
|
1076
|
+
_a["user-mismatch" /* AuthErrorCode.USER_MISMATCH */] = 'The supplied credentials do not correspond to the previously signed in user.',
|
|
1077
|
+
_a["user-signed-out" /* AuthErrorCode.USER_SIGNED_OUT */] = '',
|
|
1078
|
+
_a["weak-password" /* AuthErrorCode.WEAK_PASSWORD */] = 'The password must be 6 characters long or more.',
|
|
1079
|
+
_a["web-storage-unsupported" /* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */] = 'This browser is not supported or 3rd party cookies and data may be disabled.',
|
|
1080
|
+
_a["already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */] = 'initializeAuth() has already been called with ' +
|
|
1081
1081
|
'different options. To avoid this error, call initializeAuth() with the ' +
|
|
1082
1082
|
'same options as when it was originally called, or call getAuth() to return the' +
|
|
1083
1083
|
' already initialized instance.',
|
|
@@ -1089,7 +1089,7 @@ function _prodErrorMap() {
|
|
|
1089
1089
|
// nature of this error, developers will never be able to see the message
|
|
1090
1090
|
// using the debugErrorMap (which is installed during auth initialization).
|
|
1091
1091
|
return _a = {},
|
|
1092
|
-
_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 ' +
|
|
1092
|
+
_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 ' +
|
|
1093
1093
|
'initialized. Please be sure to call `initializeAuth` or `getAuth` before ' +
|
|
1094
1094
|
'starting any other Firebase SDK.',
|
|
1095
1095
|
_a;
|
|
@@ -1243,7 +1243,7 @@ function _logError(msg) {
|
|
|
1243
1243
|
args[_i - 1] = arguments[_i];
|
|
1244
1244
|
}
|
|
1245
1245
|
if (logClient.logLevel <= LogLevel.ERROR) {
|
|
1246
|
-
logClient.error.apply(logClient, __spreadArray(["Auth ("
|
|
1246
|
+
logClient.error.apply(logClient, __spreadArray(["Auth (".concat(SDK_VERSION, "): ").concat(msg)], args, false));
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
|
|
@@ -1268,14 +1268,14 @@ function _fail(authOrCode) {
|
|
|
1268
1268
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1269
1269
|
rest[_i - 1] = arguments[_i];
|
|
1270
1270
|
}
|
|
1271
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
1271
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
1272
1272
|
}
|
|
1273
1273
|
function _createError(authOrCode) {
|
|
1274
1274
|
var rest = [];
|
|
1275
1275
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1276
1276
|
rest[_i - 1] = arguments[_i];
|
|
1277
1277
|
}
|
|
1278
|
-
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
1278
|
+
return createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
1279
1279
|
}
|
|
1280
1280
|
function _errorWithCustomMessage(auth, code, message) {
|
|
1281
1281
|
var _a;
|
|
@@ -1289,9 +1289,9 @@ function _assertInstanceOf(auth, object, instance) {
|
|
|
1289
1289
|
var constructorInstance = instance;
|
|
1290
1290
|
if (!(object instanceof constructorInstance)) {
|
|
1291
1291
|
if (constructorInstance.name !== object.constructor.name) {
|
|
1292
|
-
_fail(auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
1292
|
+
_fail(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
1293
1293
|
}
|
|
1294
|
-
throw _errorWithCustomMessage(auth, "argument-error" /* ARGUMENT_ERROR */, "Type of "
|
|
1294
|
+
throw _errorWithCustomMessage(auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, "Type of ".concat(object.constructor.name, " does not match expected instance.") +
|
|
1295
1295
|
"Did you pass a reference from a different Auth SDK?");
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
@@ -1303,13 +1303,13 @@ function createErrorInternal(authOrCode) {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
if (typeof authOrCode !== 'string') {
|
|
1305
1305
|
var code = rest[0];
|
|
1306
|
-
var fullParams = __spreadArray([], rest.slice(1));
|
|
1306
|
+
var fullParams = __spreadArray([], rest.slice(1), true);
|
|
1307
1307
|
if (fullParams[0]) {
|
|
1308
1308
|
fullParams[0].appName = authOrCode.name;
|
|
1309
1309
|
}
|
|
1310
|
-
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams));
|
|
1310
|
+
return (_a = authOrCode._errorFactory).create.apply(_a, __spreadArray([code], fullParams, false));
|
|
1311
1311
|
}
|
|
1312
|
-
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest));
|
|
1312
|
+
return _DEFAULT_AUTH_ERROR_FACTORY.create.apply(_DEFAULT_AUTH_ERROR_FACTORY, __spreadArray([authOrCode], rest, false));
|
|
1313
1313
|
}
|
|
1314
1314
|
function _assert(assertion, authOrCode) {
|
|
1315
1315
|
var rest = [];
|
|
@@ -1317,7 +1317,7 @@ function _assert(assertion, authOrCode) {
|
|
|
1317
1317
|
rest[_i - 2] = arguments[_i];
|
|
1318
1318
|
}
|
|
1319
1319
|
if (!assertion) {
|
|
1320
|
-
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest));
|
|
1320
|
+
throw createErrorInternal.apply(void 0, __spreadArray([authOrCode], rest, false));
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
1323
|
/**
|
|
@@ -1428,7 +1428,7 @@ function initializeAuth(app, deps) {
|
|
|
1428
1428
|
return auth_1;
|
|
1429
1429
|
}
|
|
1430
1430
|
else {
|
|
1431
|
-
_fail(auth_1, "already-initialized" /* ALREADY_INITIALIZED */);
|
|
1431
|
+
_fail(auth_1, "already-initialized" /* AuthErrorCode.ALREADY_INITIALIZED */);
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
1434
|
var auth = provider.initialize({ options: deps });
|
|
@@ -1556,7 +1556,7 @@ var Delay = /** @class */ (function () {
|
|
|
1556
1556
|
Delay.prototype.get = function () {
|
|
1557
1557
|
if (!_isOnline()) {
|
|
1558
1558
|
// Pick the shorter timeout.
|
|
1559
|
-
return Math.min(5000 /* OFFLINE */, this.shortDelay);
|
|
1559
|
+
return Math.min(5000 /* DelayMin.OFFLINE */, this.shortDelay);
|
|
1560
1560
|
}
|
|
1561
1561
|
// If running in a mobile environment, return the long delay, otherwise
|
|
1562
1562
|
// return the short delay.
|
|
@@ -1589,7 +1589,7 @@ function _emulatorUrl(config, path) {
|
|
|
1589
1589
|
if (!path) {
|
|
1590
1590
|
return url;
|
|
1591
1591
|
}
|
|
1592
|
-
return ""
|
|
1592
|
+
return "".concat(url).concat(path.startsWith('/') ? path.slice(1) : path);
|
|
1593
1593
|
}
|
|
1594
1594
|
|
|
1595
1595
|
/**
|
|
@@ -1672,64 +1672,64 @@ var _a$1;
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
var SERVER_ERROR_MAP = (_a$1 = {},
|
|
1674
1674
|
// Custom token errors.
|
|
1675
|
-
_a$1["CREDENTIAL_MISMATCH" /* CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* CREDENTIAL_MISMATCH */,
|
|
1675
|
+
_a$1["CREDENTIAL_MISMATCH" /* ServerError.CREDENTIAL_MISMATCH */] = "custom-token-mismatch" /* AuthErrorCode.CREDENTIAL_MISMATCH */,
|
|
1676
1676
|
// This can only happen if the SDK sends a bad request.
|
|
1677
|
-
_a$1["MISSING_CUSTOM_TOKEN" /* MISSING_CUSTOM_TOKEN */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1677
|
+
_a$1["MISSING_CUSTOM_TOKEN" /* ServerError.MISSING_CUSTOM_TOKEN */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1678
1678
|
// Create Auth URI errors.
|
|
1679
|
-
_a$1["INVALID_IDENTIFIER" /* INVALID_IDENTIFIER */] = "invalid-email" /* INVALID_EMAIL */,
|
|
1679
|
+
_a$1["INVALID_IDENTIFIER" /* ServerError.INVALID_IDENTIFIER */] = "invalid-email" /* AuthErrorCode.INVALID_EMAIL */,
|
|
1680
1680
|
// This can only happen if the SDK sends a bad request.
|
|
1681
|
-
_a$1["MISSING_CONTINUE_URI" /* MISSING_CONTINUE_URI */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1681
|
+
_a$1["MISSING_CONTINUE_URI" /* ServerError.MISSING_CONTINUE_URI */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1682
1682
|
// Sign in with email and password errors (some apply to sign up too).
|
|
1683
|
-
_a$1["INVALID_PASSWORD" /* INVALID_PASSWORD */] = "wrong-password" /* INVALID_PASSWORD */,
|
|
1683
|
+
_a$1["INVALID_PASSWORD" /* ServerError.INVALID_PASSWORD */] = "wrong-password" /* AuthErrorCode.INVALID_PASSWORD */,
|
|
1684
1684
|
// This can only happen if the SDK sends a bad request.
|
|
1685
|
-
_a$1["MISSING_PASSWORD" /* MISSING_PASSWORD */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1685
|
+
_a$1["MISSING_PASSWORD" /* ServerError.MISSING_PASSWORD */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1686
1686
|
// Sign up with email and password errors.
|
|
1687
|
-
_a$1["EMAIL_EXISTS" /* EMAIL_EXISTS */] = "email-already-in-use" /* EMAIL_EXISTS */,
|
|
1688
|
-
_a$1["PASSWORD_LOGIN_DISABLED" /* PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* OPERATION_NOT_ALLOWED */,
|
|
1687
|
+
_a$1["EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */] = "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */,
|
|
1688
|
+
_a$1["PASSWORD_LOGIN_DISABLED" /* ServerError.PASSWORD_LOGIN_DISABLED */] = "operation-not-allowed" /* AuthErrorCode.OPERATION_NOT_ALLOWED */,
|
|
1689
1689
|
// Verify assertion for sign in with credential errors:
|
|
1690
|
-
_a$1["INVALID_IDP_RESPONSE" /* INVALID_IDP_RESPONSE */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
1691
|
-
_a$1["INVALID_PENDING_TOKEN" /* INVALID_PENDING_TOKEN */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
1692
|
-
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */,
|
|
1690
|
+
_a$1["INVALID_IDP_RESPONSE" /* ServerError.INVALID_IDP_RESPONSE */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
1691
|
+
_a$1["INVALID_PENDING_TOKEN" /* ServerError.INVALID_PENDING_TOKEN */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
1692
|
+
_a$1["FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */] = "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */,
|
|
1693
1693
|
// This can only happen if the SDK sends a bad request.
|
|
1694
|
-
_a$1["MISSING_REQ_TYPE" /* MISSING_REQ_TYPE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1694
|
+
_a$1["MISSING_REQ_TYPE" /* ServerError.MISSING_REQ_TYPE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1695
1695
|
// Send Password reset email errors:
|
|
1696
|
-
_a$1["EMAIL_NOT_FOUND" /* EMAIL_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
1697
|
-
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
1698
|
-
_a$1["EXPIRED_OOB_CODE" /* EXPIRED_OOB_CODE */] = "expired-action-code" /* EXPIRED_OOB_CODE */,
|
|
1699
|
-
_a$1["INVALID_OOB_CODE" /* INVALID_OOB_CODE */] = "invalid-action-code" /* INVALID_OOB_CODE */,
|
|
1696
|
+
_a$1["EMAIL_NOT_FOUND" /* ServerError.EMAIL_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
1697
|
+
_a$1["RESET_PASSWORD_EXCEED_LIMIT" /* ServerError.RESET_PASSWORD_EXCEED_LIMIT */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
1698
|
+
_a$1["EXPIRED_OOB_CODE" /* ServerError.EXPIRED_OOB_CODE */] = "expired-action-code" /* AuthErrorCode.EXPIRED_OOB_CODE */,
|
|
1699
|
+
_a$1["INVALID_OOB_CODE" /* ServerError.INVALID_OOB_CODE */] = "invalid-action-code" /* AuthErrorCode.INVALID_OOB_CODE */,
|
|
1700
1700
|
// This can only happen if the SDK sends a bad request.
|
|
1701
|
-
_a$1["MISSING_OOB_CODE" /* MISSING_OOB_CODE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1701
|
+
_a$1["MISSING_OOB_CODE" /* ServerError.MISSING_OOB_CODE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1702
1702
|
// Operations that require ID token in request:
|
|
1703
|
-
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
1704
|
-
_a$1["INVALID_ID_TOKEN" /* INVALID_ID_TOKEN */] = "invalid-user-token" /* INVALID_AUTH */,
|
|
1705
|
-
_a$1["TOKEN_EXPIRED" /* TOKEN_EXPIRED */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
1706
|
-
_a$1["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-token-expired" /* TOKEN_EXPIRED */,
|
|
1703
|
+
_a$1["CREDENTIAL_TOO_OLD_LOGIN_AGAIN" /* ServerError.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */] = "requires-recent-login" /* AuthErrorCode.CREDENTIAL_TOO_OLD_LOGIN_AGAIN */,
|
|
1704
|
+
_a$1["INVALID_ID_TOKEN" /* ServerError.INVALID_ID_TOKEN */] = "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */,
|
|
1705
|
+
_a$1["TOKEN_EXPIRED" /* ServerError.TOKEN_EXPIRED */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
1706
|
+
_a$1["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */,
|
|
1707
1707
|
// Other errors.
|
|
1708
|
-
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
1708
|
+
_a$1["TOO_MANY_ATTEMPTS_TRY_LATER" /* ServerError.TOO_MANY_ATTEMPTS_TRY_LATER */] = "too-many-requests" /* AuthErrorCode.TOO_MANY_ATTEMPTS_TRY_LATER */,
|
|
1709
1709
|
// Phone Auth related errors.
|
|
1710
|
-
_a$1["INVALID_CODE" /* INVALID_CODE */] = "invalid-verification-code" /* INVALID_CODE */,
|
|
1711
|
-
_a$1["INVALID_SESSION_INFO" /* INVALID_SESSION_INFO */] = "invalid-verification-id" /* INVALID_SESSION_INFO */,
|
|
1712
|
-
_a$1["INVALID_TEMPORARY_PROOF" /* INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* INVALID_IDP_RESPONSE */,
|
|
1713
|
-
_a$1["MISSING_SESSION_INFO" /* MISSING_SESSION_INFO */] = "missing-verification-id" /* MISSING_SESSION_INFO */,
|
|
1714
|
-
_a$1["SESSION_EXPIRED" /* SESSION_EXPIRED */] = "code-expired" /* CODE_EXPIRED */,
|
|
1710
|
+
_a$1["INVALID_CODE" /* ServerError.INVALID_CODE */] = "invalid-verification-code" /* AuthErrorCode.INVALID_CODE */,
|
|
1711
|
+
_a$1["INVALID_SESSION_INFO" /* ServerError.INVALID_SESSION_INFO */] = "invalid-verification-id" /* AuthErrorCode.INVALID_SESSION_INFO */,
|
|
1712
|
+
_a$1["INVALID_TEMPORARY_PROOF" /* ServerError.INVALID_TEMPORARY_PROOF */] = "invalid-credential" /* AuthErrorCode.INVALID_IDP_RESPONSE */,
|
|
1713
|
+
_a$1["MISSING_SESSION_INFO" /* ServerError.MISSING_SESSION_INFO */] = "missing-verification-id" /* AuthErrorCode.MISSING_SESSION_INFO */,
|
|
1714
|
+
_a$1["SESSION_EXPIRED" /* ServerError.SESSION_EXPIRED */] = "code-expired" /* AuthErrorCode.CODE_EXPIRED */,
|
|
1715
1715
|
// Other action code errors when additional settings passed.
|
|
1716
1716
|
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
1717
1717
|
// This is OK as this error will be caught by client side validation.
|
|
1718
|
-
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */,
|
|
1719
|
-
_a$1["UNAUTHORIZED_DOMAIN" /* UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* UNAUTHORIZED_DOMAIN */,
|
|
1718
|
+
_a$1["MISSING_ANDROID_PACKAGE_NAME" /* ServerError.MISSING_ANDROID_PACKAGE_NAME */] = "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */,
|
|
1719
|
+
_a$1["UNAUTHORIZED_DOMAIN" /* ServerError.UNAUTHORIZED_DOMAIN */] = "unauthorized-continue-uri" /* AuthErrorCode.UNAUTHORIZED_DOMAIN */,
|
|
1720
1720
|
// getProjectConfig errors when clientId is passed.
|
|
1721
|
-
_a$1["INVALID_OAUTH_CLIENT_ID" /* INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* INVALID_OAUTH_CLIENT_ID */,
|
|
1721
|
+
_a$1["INVALID_OAUTH_CLIENT_ID" /* ServerError.INVALID_OAUTH_CLIENT_ID */] = "invalid-oauth-client-id" /* AuthErrorCode.INVALID_OAUTH_CLIENT_ID */,
|
|
1722
1722
|
// User actions (sign-up or deletion) disabled errors.
|
|
1723
|
-
_a$1["ADMIN_ONLY_OPERATION" /* ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* ADMIN_ONLY_OPERATION */,
|
|
1723
|
+
_a$1["ADMIN_ONLY_OPERATION" /* ServerError.ADMIN_ONLY_OPERATION */] = "admin-restricted-operation" /* AuthErrorCode.ADMIN_ONLY_OPERATION */,
|
|
1724
1724
|
// Multi factor related errors.
|
|
1725
|
-
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* INVALID_MFA_SESSION */,
|
|
1726
|
-
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* MFA_INFO_NOT_FOUND */,
|
|
1727
|
-
_a$1["MISSING_MFA_ENROLLMENT_ID" /* MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* MISSING_MFA_INFO */,
|
|
1728
|
-
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* MISSING_MFA_SESSION */,
|
|
1729
|
-
_a$1["SECOND_FACTOR_EXISTS" /* SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
1730
|
-
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
1725
|
+
_a$1["INVALID_MFA_PENDING_CREDENTIAL" /* ServerError.INVALID_MFA_PENDING_CREDENTIAL */] = "invalid-multi-factor-session" /* AuthErrorCode.INVALID_MFA_SESSION */,
|
|
1726
|
+
_a$1["MFA_ENROLLMENT_NOT_FOUND" /* ServerError.MFA_ENROLLMENT_NOT_FOUND */] = "multi-factor-info-not-found" /* AuthErrorCode.MFA_INFO_NOT_FOUND */,
|
|
1727
|
+
_a$1["MISSING_MFA_ENROLLMENT_ID" /* ServerError.MISSING_MFA_ENROLLMENT_ID */] = "missing-multi-factor-info" /* AuthErrorCode.MISSING_MFA_INFO */,
|
|
1728
|
+
_a$1["MISSING_MFA_PENDING_CREDENTIAL" /* ServerError.MISSING_MFA_PENDING_CREDENTIAL */] = "missing-multi-factor-session" /* AuthErrorCode.MISSING_MFA_SESSION */,
|
|
1729
|
+
_a$1["SECOND_FACTOR_EXISTS" /* ServerError.SECOND_FACTOR_EXISTS */] = "second-factor-already-in-use" /* AuthErrorCode.SECOND_FACTOR_ALREADY_ENROLLED */,
|
|
1730
|
+
_a$1["SECOND_FACTOR_LIMIT_EXCEEDED" /* ServerError.SECOND_FACTOR_LIMIT_EXCEEDED */] = "maximum-second-factor-count-exceeded" /* AuthErrorCode.SECOND_FACTOR_LIMIT_EXCEEDED */,
|
|
1731
1731
|
// Blocking functions related errors.
|
|
1732
|
-
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* INTERNAL_ERROR */,
|
|
1732
|
+
_a$1["BLOCKING_FUNCTION_ERROR_RESPONSE" /* ServerError.BLOCKING_FUNCTION_ERROR_RESPONSE */] = "internal-error" /* AuthErrorCode.INTERNAL_ERROR */,
|
|
1733
1733
|
_a$1);
|
|
1734
1734
|
|
|
1735
1735
|
/**
|
|
@@ -1768,7 +1768,7 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
1768
1768
|
body = {};
|
|
1769
1769
|
params = {};
|
|
1770
1770
|
if (request) {
|
|
1771
|
-
if (method === "GET" /* GET */) {
|
|
1771
|
+
if (method === "GET" /* HttpMethod.GET */) {
|
|
1772
1772
|
params = request;
|
|
1773
1773
|
}
|
|
1774
1774
|
else {
|
|
@@ -1781,12 +1781,11 @@ function _performApiRequest(auth, method, path, request, customErrorMap) {
|
|
|
1781
1781
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
1782
1782
|
case 1:
|
|
1783
1783
|
headers = _a.sent();
|
|
1784
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/json';
|
|
1784
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/json';
|
|
1785
1785
|
if (auth.languageCode) {
|
|
1786
|
-
headers["X-Firebase-Locale" /* X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
1786
|
+
headers["X-Firebase-Locale" /* HttpHeader.X_FIREBASE_LOCALE */] = auth.languageCode;
|
|
1787
1787
|
}
|
|
1788
|
-
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method,
|
|
1789
|
-
headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
1788
|
+
return [2 /*return*/, FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), __assign({ method: method, headers: headers, referrerPolicy: 'no-referrer' }, body))];
|
|
1790
1789
|
}
|
|
1791
1790
|
});
|
|
1792
1791
|
}); })];
|
|
@@ -1818,7 +1817,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1818
1817
|
case 3:
|
|
1819
1818
|
json = _b.sent();
|
|
1820
1819
|
if ('needConfirmation' in json) {
|
|
1821
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, json);
|
|
1820
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, json);
|
|
1822
1821
|
}
|
|
1823
1822
|
if (response.ok && !('errorMessage' in json)) {
|
|
1824
1823
|
return [2 /*return*/, json];
|
|
@@ -1826,14 +1825,14 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1826
1825
|
else {
|
|
1827
1826
|
errorMessage = response.ok ? json.errorMessage : json.error.message;
|
|
1828
1827
|
_a = errorMessage.split(' : '), serverErrorCode = _a[0], serverErrorMessage = _a[1];
|
|
1829
|
-
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1830
|
-
throw _makeTaggedError(auth, "credential-already-in-use" /* CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1828
|
+
if (serverErrorCode === "FEDERATED_USER_ID_ALREADY_LINKED" /* ServerError.FEDERATED_USER_ID_ALREADY_LINKED */) {
|
|
1829
|
+
throw _makeTaggedError(auth, "credential-already-in-use" /* AuthErrorCode.CREDENTIAL_ALREADY_IN_USE */, json);
|
|
1831
1830
|
}
|
|
1832
|
-
else if (serverErrorCode === "EMAIL_EXISTS" /* EMAIL_EXISTS */) {
|
|
1833
|
-
throw _makeTaggedError(auth, "email-already-in-use" /* EMAIL_EXISTS */, json);
|
|
1831
|
+
else if (serverErrorCode === "EMAIL_EXISTS" /* ServerError.EMAIL_EXISTS */) {
|
|
1832
|
+
throw _makeTaggedError(auth, "email-already-in-use" /* AuthErrorCode.EMAIL_EXISTS */, json);
|
|
1834
1833
|
}
|
|
1835
|
-
else if (serverErrorCode === "USER_DISABLED" /* USER_DISABLED */) {
|
|
1836
|
-
throw _makeTaggedError(auth, "user-disabled" /* USER_DISABLED */, json);
|
|
1834
|
+
else if (serverErrorCode === "USER_DISABLED" /* ServerError.USER_DISABLED */) {
|
|
1835
|
+
throw _makeTaggedError(auth, "user-disabled" /* AuthErrorCode.USER_DISABLED */, json);
|
|
1837
1836
|
}
|
|
1838
1837
|
authError = errorMap[serverErrorCode] ||
|
|
1839
1838
|
serverErrorCode
|
|
@@ -1852,7 +1851,7 @@ function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
|
1852
1851
|
if (e_1 instanceof FirebaseError) {
|
|
1853
1852
|
throw e_1;
|
|
1854
1853
|
}
|
|
1855
|
-
_fail(auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */);
|
|
1854
|
+
_fail(auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */);
|
|
1856
1855
|
return [3 /*break*/, 5];
|
|
1857
1856
|
case 5: return [2 /*return*/];
|
|
1858
1857
|
}
|
|
@@ -1869,7 +1868,7 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1869
1868
|
case 1:
|
|
1870
1869
|
serverResponse = (_a.sent());
|
|
1871
1870
|
if ('mfaPendingCredential' in serverResponse) {
|
|
1872
|
-
_fail(auth, "multi-factor-auth-required" /* MFA_REQUIRED */, {
|
|
1871
|
+
_fail(auth, "multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */, {
|
|
1873
1872
|
_serverResponse: serverResponse
|
|
1874
1873
|
});
|
|
1875
1874
|
}
|
|
@@ -1879,9 +1878,9 @@ function _performSignInRequest(auth, method, path, request, customErrorMap) {
|
|
|
1879
1878
|
});
|
|
1880
1879
|
}
|
|
1881
1880
|
function _getFinalTarget(auth, host, path, query) {
|
|
1882
|
-
var base = ""
|
|
1881
|
+
var base = "".concat(host).concat(path, "?").concat(query);
|
|
1883
1882
|
if (!auth.config.emulator) {
|
|
1884
|
-
return auth.config.apiScheme
|
|
1883
|
+
return "".concat(auth.config.apiScheme, "://").concat(base);
|
|
1885
1884
|
}
|
|
1886
1885
|
return _emulatorUrl(auth.config, base);
|
|
1887
1886
|
}
|
|
@@ -1895,7 +1894,7 @@ var NetworkTimeout = /** @class */ (function () {
|
|
|
1895
1894
|
this.timer = null;
|
|
1896
1895
|
this.promise = new Promise(function (_, reject) {
|
|
1897
1896
|
_this.timer = setTimeout(function () {
|
|
1898
|
-
return reject(_createError(_this.auth, "network-request-failed" /* NETWORK_REQUEST_FAILED */));
|
|
1897
|
+
return reject(_createError(_this.auth, "network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */));
|
|
1899
1898
|
}, DEFAULT_API_TIMEOUT_MS.get());
|
|
1900
1899
|
});
|
|
1901
1900
|
}
|
|
@@ -1939,21 +1938,21 @@ function _makeTaggedError(auth, code, response) {
|
|
|
1939
1938
|
function deleteAccount(auth, request) {
|
|
1940
1939
|
return __awaiter(this, void 0, void 0, function () {
|
|
1941
1940
|
return __generator(this, function (_a) {
|
|
1942
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:delete" /* DELETE_ACCOUNT */, request)];
|
|
1941
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:delete" /* Endpoint.DELETE_ACCOUNT */, request)];
|
|
1943
1942
|
});
|
|
1944
1943
|
});
|
|
1945
1944
|
}
|
|
1946
1945
|
function deleteLinkedAccounts(auth, request) {
|
|
1947
1946
|
return __awaiter(this, void 0, void 0, function () {
|
|
1948
1947
|
return __generator(this, function (_a) {
|
|
1949
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
1948
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
1950
1949
|
});
|
|
1951
1950
|
});
|
|
1952
1951
|
}
|
|
1953
1952
|
function getAccountInfo(auth, request) {
|
|
1954
1953
|
return __awaiter(this, void 0, void 0, function () {
|
|
1955
1954
|
return __generator(this, function (_a) {
|
|
1956
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:lookup" /* GET_ACCOUNT_INFO */, request)];
|
|
1955
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:lookup" /* Endpoint.GET_ACCOUNT_INFO */, request)];
|
|
1957
1956
|
});
|
|
1958
1957
|
});
|
|
1959
1958
|
}
|
|
@@ -2049,7 +2048,7 @@ function getIdTokenResult(user, forceRefresh) {
|
|
|
2049
2048
|
case 1:
|
|
2050
2049
|
token = _a.sent();
|
|
2051
2050
|
claims = _parseToken(token);
|
|
2052
|
-
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2051
|
+
_assert(claims && claims.exp && claims.auth_time && claims.iat, userInternal.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2053
2052
|
firebase = typeof claims.firebase === 'object' ? claims.firebase : undefined;
|
|
2054
2053
|
signInProvider = firebase === null || firebase === void 0 ? void 0 : firebase['sign_in_provider'];
|
|
2055
2054
|
return [2 /*return*/, {
|
|
@@ -2069,8 +2068,7 @@ function secondsStringToMilliseconds(seconds) {
|
|
|
2069
2068
|
return Number(seconds) * 1000;
|
|
2070
2069
|
}
|
|
2071
2070
|
function _parseToken(token) {
|
|
2072
|
-
var _a;
|
|
2073
|
-
var _b = token.split('.'), algorithm = _b[0], payload = _b[1], signature = _b[2];
|
|
2071
|
+
var _a = token.split('.'), algorithm = _a[0], payload = _a[1], signature = _a[2];
|
|
2074
2072
|
if (algorithm === undefined ||
|
|
2075
2073
|
payload === undefined ||
|
|
2076
2074
|
signature === undefined) {
|
|
@@ -2086,7 +2084,7 @@ function _parseToken(token) {
|
|
|
2086
2084
|
return JSON.parse(decoded);
|
|
2087
2085
|
}
|
|
2088
2086
|
catch (e) {
|
|
2089
|
-
_logError('Caught error parsing JWT payload as JSON',
|
|
2087
|
+
_logError('Caught error parsing JWT payload as JSON', e === null || e === void 0 ? void 0 : e.toString());
|
|
2090
2088
|
return null;
|
|
2091
2089
|
}
|
|
2092
2090
|
}
|
|
@@ -2095,9 +2093,9 @@ function _parseToken(token) {
|
|
|
2095
2093
|
*/
|
|
2096
2094
|
function _tokenExpiresIn(token) {
|
|
2097
2095
|
var parsedToken = _parseToken(token);
|
|
2098
|
-
_assert(parsedToken, "internal-error" /* INTERNAL_ERROR */);
|
|
2099
|
-
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
2100
|
-
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
2096
|
+
_assert(parsedToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2097
|
+
_assert(typeof parsedToken.exp !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2098
|
+
_assert(typeof parsedToken.iat !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2101
2099
|
return Number(parsedToken.exp) - Number(parsedToken.iat);
|
|
2102
2100
|
}
|
|
2103
2101
|
|
|
@@ -2148,8 +2146,8 @@ function _logoutIfInvalidated(user, promise, bypassAuthState) {
|
|
|
2148
2146
|
}
|
|
2149
2147
|
function isUserInvalidated(_a) {
|
|
2150
2148
|
var code = _a.code;
|
|
2151
|
-
return (code === "auth/"
|
|
2152
|
-
code === "auth/"
|
|
2149
|
+
return (code === "auth/".concat("user-disabled" /* AuthErrorCode.USER_DISABLED */) ||
|
|
2150
|
+
code === "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */));
|
|
2153
2151
|
}
|
|
2154
2152
|
|
|
2155
2153
|
/**
|
|
@@ -2177,7 +2175,7 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
2177
2175
|
// we can't cast properly in both environments.
|
|
2178
2176
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2179
2177
|
this.timerId = null;
|
|
2180
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
2178
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
2181
2179
|
}
|
|
2182
2180
|
ProactiveRefresh.prototype._start = function () {
|
|
2183
2181
|
if (this.isRunning) {
|
|
@@ -2199,14 +2197,14 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
2199
2197
|
var _a;
|
|
2200
2198
|
if (wasError) {
|
|
2201
2199
|
var interval = this.errorBackoff;
|
|
2202
|
-
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* RETRY_BACKOFF_MAX */);
|
|
2200
|
+
this.errorBackoff = Math.min(this.errorBackoff * 2, 960000 /* Duration.RETRY_BACKOFF_MAX */);
|
|
2203
2201
|
return interval;
|
|
2204
2202
|
}
|
|
2205
2203
|
else {
|
|
2206
2204
|
// Reset the error backoff
|
|
2207
|
-
this.errorBackoff = 30000 /* RETRY_BACKOFF_MIN */;
|
|
2205
|
+
this.errorBackoff = 30000 /* Duration.RETRY_BACKOFF_MIN */;
|
|
2208
2206
|
var expTime = (_a = this.user.stsTokenManager.expirationTime) !== null && _a !== void 0 ? _a : 0;
|
|
2209
|
-
var interval = expTime - Date.now() - 300000 /* OFFSET */;
|
|
2207
|
+
var interval = expTime - Date.now() - 300000 /* Duration.OFFSET */;
|
|
2210
2208
|
return Math.max(0, interval);
|
|
2211
2209
|
}
|
|
2212
2210
|
};
|
|
@@ -2230,22 +2228,21 @@ var ProactiveRefresh = /** @class */ (function () {
|
|
|
2230
2228
|
}); }, interval);
|
|
2231
2229
|
};
|
|
2232
2230
|
ProactiveRefresh.prototype.iteration = function () {
|
|
2233
|
-
var _a;
|
|
2234
2231
|
return __awaiter(this, void 0, void 0, function () {
|
|
2235
2232
|
var e_1;
|
|
2236
|
-
return __generator(this, function (
|
|
2237
|
-
switch (
|
|
2233
|
+
return __generator(this, function (_a) {
|
|
2234
|
+
switch (_a.label) {
|
|
2238
2235
|
case 0:
|
|
2239
|
-
|
|
2236
|
+
_a.trys.push([0, 2, , 3]);
|
|
2240
2237
|
return [4 /*yield*/, this.user.getIdToken(true)];
|
|
2241
2238
|
case 1:
|
|
2242
|
-
|
|
2239
|
+
_a.sent();
|
|
2243
2240
|
return [3 /*break*/, 3];
|
|
2244
2241
|
case 2:
|
|
2245
|
-
e_1 =
|
|
2242
|
+
e_1 = _a.sent();
|
|
2246
2243
|
// Only retry on network errors
|
|
2247
|
-
if ((
|
|
2248
|
-
"auth/"
|
|
2244
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) ===
|
|
2245
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
2249
2246
|
this.schedule(/* wasError */ true);
|
|
2250
2247
|
}
|
|
2251
2248
|
return [2 /*return*/];
|
|
@@ -2329,7 +2326,7 @@ function _reloadWithoutSaving(user) {
|
|
|
2329
2326
|
return [4 /*yield*/, _logoutIfInvalidated(user, getAccountInfo(auth, { idToken: idToken }))];
|
|
2330
2327
|
case 2:
|
|
2331
2328
|
response = _b.sent();
|
|
2332
|
-
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2329
|
+
_assert(response === null || response === void 0 ? void 0 : response.users.length, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2333
2330
|
coreAccount = response.users[0];
|
|
2334
2331
|
user._notifyReloadListener(coreAccount);
|
|
2335
2332
|
newProviderData = ((_a = coreAccount.providerUserInfo) === null || _a === void 0 ? void 0 : _a.length)
|
|
@@ -2391,7 +2388,7 @@ function reload(user) {
|
|
|
2391
2388
|
}
|
|
2392
2389
|
function mergeProviderData(original, newData) {
|
|
2393
2390
|
var deduped = original.filter(function (o) { return !newData.some(function (n) { return n.providerId === o.providerId; }); });
|
|
2394
|
-
return __spreadArray(__spreadArray([], deduped), newData);
|
|
2391
|
+
return __spreadArray(__spreadArray([], deduped, true), newData, true);
|
|
2395
2392
|
}
|
|
2396
2393
|
function extractProviderData(providers) {
|
|
2397
2394
|
return providers.map(function (_a) {
|
|
@@ -2439,13 +2436,13 @@ function requestStsToken(auth, refreshToken) {
|
|
|
2439
2436
|
'refresh_token': refreshToken
|
|
2440
2437
|
}).slice(1);
|
|
2441
2438
|
_a = auth.config, tokenApiHost = _a.tokenApiHost, apiKey = _a.apiKey;
|
|
2442
|
-
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* TOKEN */, "key="
|
|
2439
|
+
url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, "key=".concat(apiKey));
|
|
2443
2440
|
return [4 /*yield*/, auth._getAdditionalHeaders()];
|
|
2444
2441
|
case 1:
|
|
2445
2442
|
headers = _b.sent();
|
|
2446
|
-
headers["Content-Type" /* CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
2443
|
+
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
2447
2444
|
return [2 /*return*/, FetchProvider.fetch()(url, {
|
|
2448
|
-
method: "POST" /* POST */,
|
|
2445
|
+
method: "POST" /* HttpMethod.POST */,
|
|
2449
2446
|
headers: headers,
|
|
2450
2447
|
body: body
|
|
2451
2448
|
})];
|
|
@@ -2496,15 +2493,15 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
2496
2493
|
Object.defineProperty(StsTokenManager.prototype, "isExpired", {
|
|
2497
2494
|
get: function () {
|
|
2498
2495
|
return (!this.expirationTime ||
|
|
2499
|
-
Date.now() > this.expirationTime - 30000 /* TOKEN_REFRESH */);
|
|
2496
|
+
Date.now() > this.expirationTime - 30000 /* Buffer.TOKEN_REFRESH */);
|
|
2500
2497
|
},
|
|
2501
2498
|
enumerable: false,
|
|
2502
2499
|
configurable: true
|
|
2503
2500
|
});
|
|
2504
2501
|
StsTokenManager.prototype.updateFromServerResponse = function (response) {
|
|
2505
|
-
_assert(response.idToken, "internal-error" /* INTERNAL_ERROR */);
|
|
2506
|
-
_assert(typeof response.idToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
2507
|
-
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* INTERNAL_ERROR */);
|
|
2502
|
+
_assert(response.idToken, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2503
|
+
_assert(typeof response.idToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2504
|
+
_assert(typeof response.refreshToken !== 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2508
2505
|
var expiresIn = 'expiresIn' in response && typeof response.expiresIn !== 'undefined'
|
|
2509
2506
|
? Number(response.expiresIn)
|
|
2510
2507
|
: _tokenExpiresIn(response.idToken);
|
|
@@ -2516,7 +2513,7 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
2516
2513
|
return __generator(this, function (_a) {
|
|
2517
2514
|
switch (_a.label) {
|
|
2518
2515
|
case 0:
|
|
2519
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* TOKEN_EXPIRED */);
|
|
2516
|
+
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
2520
2517
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
2521
2518
|
return [2 /*return*/, this.accessToken];
|
|
2522
2519
|
}
|
|
@@ -2556,19 +2553,19 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
2556
2553
|
var refreshToken = object.refreshToken, accessToken = object.accessToken, expirationTime = object.expirationTime;
|
|
2557
2554
|
var manager = new StsTokenManager();
|
|
2558
2555
|
if (refreshToken) {
|
|
2559
|
-
_assert(typeof refreshToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
2556
|
+
_assert(typeof refreshToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
2560
2557
|
appName: appName
|
|
2561
2558
|
});
|
|
2562
2559
|
manager.refreshToken = refreshToken;
|
|
2563
2560
|
}
|
|
2564
2561
|
if (accessToken) {
|
|
2565
|
-
_assert(typeof accessToken === 'string', "internal-error" /* INTERNAL_ERROR */, {
|
|
2562
|
+
_assert(typeof accessToken === 'string', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
2566
2563
|
appName: appName
|
|
2567
2564
|
});
|
|
2568
2565
|
manager.accessToken = accessToken;
|
|
2569
2566
|
}
|
|
2570
2567
|
if (expirationTime) {
|
|
2571
|
-
_assert(typeof expirationTime === 'number', "internal-error" /* INTERNAL_ERROR */, {
|
|
2568
|
+
_assert(typeof expirationTime === 'number', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, {
|
|
2572
2569
|
appName: appName
|
|
2573
2570
|
});
|
|
2574
2571
|
manager.expirationTime = expirationTime;
|
|
@@ -2613,13 +2610,13 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
2613
2610
|
* limitations under the License.
|
|
2614
2611
|
*/
|
|
2615
2612
|
function assertStringOrUndefined(assertion, appName) {
|
|
2616
|
-
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* INTERNAL_ERROR */, { appName: appName });
|
|
2613
|
+
_assert(typeof assertion === 'string' || typeof assertion === 'undefined', "internal-error" /* AuthErrorCode.INTERNAL_ERROR */, { appName: appName });
|
|
2617
2614
|
}
|
|
2618
2615
|
var UserImpl = /** @class */ (function () {
|
|
2619
2616
|
function UserImpl(_a) {
|
|
2620
2617
|
var uid = _a.uid, auth = _a.auth, stsTokenManager = _a.stsTokenManager, opt = __rest(_a, ["uid", "auth", "stsTokenManager"]);
|
|
2621
2618
|
// For the user object, provider is always Firebase.
|
|
2622
|
-
this.providerId = "firebase" /* FIREBASE */;
|
|
2619
|
+
this.providerId = "firebase" /* ProviderId.FIREBASE */;
|
|
2623
2620
|
this.proactiveRefresh = new ProactiveRefresh(this);
|
|
2624
2621
|
this.reloadUserInfo = null;
|
|
2625
2622
|
this.reloadListener = null;
|
|
@@ -2634,7 +2631,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2634
2631
|
this.photoURL = opt.photoURL || null;
|
|
2635
2632
|
this.isAnonymous = opt.isAnonymous || false;
|
|
2636
2633
|
this.tenantId = opt.tenantId || null;
|
|
2637
|
-
this.providerData = opt.providerData ? __spreadArray([], opt.providerData) : [];
|
|
2634
|
+
this.providerData = opt.providerData ? __spreadArray([], opt.providerData, true) : [];
|
|
2638
2635
|
this.metadata = new UserMetadata(opt.createdAt || undefined, opt.lastLoginAt || undefined);
|
|
2639
2636
|
}
|
|
2640
2637
|
UserImpl.prototype.getIdToken = function (forceRefresh) {
|
|
@@ -2645,7 +2642,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2645
2642
|
case 0: return [4 /*yield*/, _logoutIfInvalidated(this, this.stsTokenManager.getToken(this.auth, forceRefresh))];
|
|
2646
2643
|
case 1:
|
|
2647
2644
|
accessToken = _a.sent();
|
|
2648
|
-
_assert(accessToken, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2645
|
+
_assert(accessToken, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2649
2646
|
if (!(this.accessToken !== accessToken)) return [3 /*break*/, 3];
|
|
2650
2647
|
this.accessToken = accessToken;
|
|
2651
2648
|
return [4 /*yield*/, this.auth._persistUserIfCurrent(this)];
|
|
@@ -2668,7 +2665,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2668
2665
|
if (this === user) {
|
|
2669
2666
|
return;
|
|
2670
2667
|
}
|
|
2671
|
-
_assert(this.uid === user.uid, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2668
|
+
_assert(this.uid === user.uid, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2672
2669
|
this.displayName = user.displayName;
|
|
2673
2670
|
this.photoURL = user.photoURL;
|
|
2674
2671
|
this.email = user.email;
|
|
@@ -2685,7 +2682,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2685
2682
|
};
|
|
2686
2683
|
UserImpl.prototype._onReload = function (callback) {
|
|
2687
2684
|
// There should only ever be one listener, and that is a single instance of MultiFactorUser
|
|
2688
|
-
_assert(!this.reloadListener, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2685
|
+
_assert(!this.reloadListener, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2689
2686
|
this.reloadListener = callback;
|
|
2690
2687
|
if (this.reloadUserInfo) {
|
|
2691
2688
|
this._notifyReloadListener(this.reloadUserInfo);
|
|
@@ -2781,13 +2778,13 @@ var UserImpl = /** @class */ (function () {
|
|
|
2781
2778
|
var createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
2782
2779
|
var lastLoginAt = (_h = object.lastLoginAt) !== null && _h !== void 0 ? _h : undefined;
|
|
2783
2780
|
var uid = object.uid, emailVerified = object.emailVerified, isAnonymous = object.isAnonymous, providerData = object.providerData, plainObjectTokenManager = object.stsTokenManager;
|
|
2784
|
-
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2781
|
+
_assert(uid && plainObjectTokenManager, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2785
2782
|
var stsTokenManager = StsTokenManager.fromJSON(this.name, plainObjectTokenManager);
|
|
2786
|
-
_assert(typeof uid === 'string', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2783
|
+
_assert(typeof uid === 'string', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2787
2784
|
assertStringOrUndefined(displayName, auth.name);
|
|
2788
2785
|
assertStringOrUndefined(email, auth.name);
|
|
2789
|
-
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2790
|
-
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* INTERNAL_ERROR */);
|
|
2786
|
+
_assert(typeof emailVerified === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2787
|
+
_assert(typeof isAnonymous === 'boolean', auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2791
2788
|
assertStringOrUndefined(phoneNumber, auth.name);
|
|
2792
2789
|
assertStringOrUndefined(photoURL, auth.name);
|
|
2793
2790
|
assertStringOrUndefined(tenantId, auth.name);
|
|
@@ -2867,7 +2864,7 @@ var UserImpl = /** @class */ (function () {
|
|
|
2867
2864
|
*/
|
|
2868
2865
|
var InMemoryPersistence = /** @class */ (function () {
|
|
2869
2866
|
function InMemoryPersistence() {
|
|
2870
|
-
this.type = "NONE" /* NONE */;
|
|
2867
|
+
this.type = "NONE" /* PersistenceType.NONE */;
|
|
2871
2868
|
this.storage = {};
|
|
2872
2869
|
}
|
|
2873
2870
|
InMemoryPersistence.prototype._isAvailable = function () {
|
|
@@ -2937,7 +2934,7 @@ var inMemoryPersistence = InMemoryPersistence;
|
|
|
2937
2934
|
* limitations under the License.
|
|
2938
2935
|
*/
|
|
2939
2936
|
function _persistenceKeyName(key, apiKey, appName) {
|
|
2940
|
-
return "firebase" /* PERSISTENCE
|
|
2937
|
+
return "".concat("firebase" /* Namespace.PERSISTENCE */, ":").concat(key, ":").concat(apiKey, ":").concat(appName);
|
|
2941
2938
|
}
|
|
2942
2939
|
var PersistenceUserManager = /** @class */ (function () {
|
|
2943
2940
|
function PersistenceUserManager(persistence, auth, userKey) {
|
|
@@ -2946,7 +2943,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
2946
2943
|
this.userKey = userKey;
|
|
2947
2944
|
var _a = this.auth, config = _a.config, name = _a.name;
|
|
2948
2945
|
this.fullUserKey = _persistenceKeyName(this.userKey, config.apiKey, name);
|
|
2949
|
-
this.fullPersistenceKey = _persistenceKeyName("persistence" /* PERSISTENCE_USER */, config.apiKey, name);
|
|
2946
|
+
this.fullPersistenceKey = _persistenceKeyName("persistence" /* KeyName.PERSISTENCE_USER */, config.apiKey, name);
|
|
2950
2947
|
this.boundEventHandler = auth._onStorageEvent.bind(auth);
|
|
2951
2948
|
this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
2952
2949
|
}
|
|
@@ -3000,7 +2997,7 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
3000
2997
|
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
3001
2998
|
};
|
|
3002
2999
|
PersistenceUserManager.create = function (auth, persistenceHierarchy, userKey) {
|
|
3003
|
-
if (userKey === void 0) { userKey = "authUser" /* AUTH_USER */; }
|
|
3000
|
+
if (userKey === void 0) { userKey = "authUser" /* KeyName.AUTH_USER */; }
|
|
3004
3001
|
return __awaiter(this, void 0, void 0, function () {
|
|
3005
3002
|
var availablePersistences, selectedPersistence, key, userToMigrate, _i, persistenceHierarchy_1, persistence, blob, user, migrationHierarchy;
|
|
3006
3003
|
var _this = this;
|
|
@@ -3127,42 +3124,42 @@ var PersistenceUserManager = /** @class */ (function () {
|
|
|
3127
3124
|
function _getBrowserName(userAgent) {
|
|
3128
3125
|
var ua = userAgent.toLowerCase();
|
|
3129
3126
|
if (ua.includes('opera/') || ua.includes('opr/') || ua.includes('opios/')) {
|
|
3130
|
-
return "Opera" /* OPERA */;
|
|
3127
|
+
return "Opera" /* BrowserName.OPERA */;
|
|
3131
3128
|
}
|
|
3132
3129
|
else if (_isIEMobile(ua)) {
|
|
3133
3130
|
// Windows phone IEMobile browser.
|
|
3134
|
-
return "IEMobile" /* IEMOBILE */;
|
|
3131
|
+
return "IEMobile" /* BrowserName.IEMOBILE */;
|
|
3135
3132
|
}
|
|
3136
3133
|
else if (ua.includes('msie') || ua.includes('trident/')) {
|
|
3137
|
-
return "IE" /* IE */;
|
|
3134
|
+
return "IE" /* BrowserName.IE */;
|
|
3138
3135
|
}
|
|
3139
3136
|
else if (ua.includes('edge/')) {
|
|
3140
|
-
return "Edge" /* EDGE */;
|
|
3137
|
+
return "Edge" /* BrowserName.EDGE */;
|
|
3141
3138
|
}
|
|
3142
3139
|
else if (_isFirefox(ua)) {
|
|
3143
|
-
return "Firefox" /* FIREFOX */;
|
|
3140
|
+
return "Firefox" /* BrowserName.FIREFOX */;
|
|
3144
3141
|
}
|
|
3145
3142
|
else if (ua.includes('silk/')) {
|
|
3146
|
-
return "Silk" /* SILK */;
|
|
3143
|
+
return "Silk" /* BrowserName.SILK */;
|
|
3147
3144
|
}
|
|
3148
3145
|
else if (_isBlackBerry(ua)) {
|
|
3149
3146
|
// Blackberry browser.
|
|
3150
|
-
return "Blackberry" /* BLACKBERRY */;
|
|
3147
|
+
return "Blackberry" /* BrowserName.BLACKBERRY */;
|
|
3151
3148
|
}
|
|
3152
3149
|
else if (_isWebOS(ua)) {
|
|
3153
3150
|
// WebOS default browser.
|
|
3154
|
-
return "Webos" /* WEBOS */;
|
|
3151
|
+
return "Webos" /* BrowserName.WEBOS */;
|
|
3155
3152
|
}
|
|
3156
3153
|
else if (_isSafari(ua)) {
|
|
3157
|
-
return "Safari" /* SAFARI */;
|
|
3154
|
+
return "Safari" /* BrowserName.SAFARI */;
|
|
3158
3155
|
}
|
|
3159
3156
|
else if ((ua.includes('chrome/') || _isChromeIOS(ua)) &&
|
|
3160
3157
|
!ua.includes('edge/')) {
|
|
3161
|
-
return "Chrome" /* CHROME */;
|
|
3158
|
+
return "Chrome" /* BrowserName.CHROME */;
|
|
3162
3159
|
}
|
|
3163
3160
|
else if (_isAndroid(ua)) {
|
|
3164
3161
|
// Android stock browser.
|
|
3165
|
-
return "Android" /* ANDROID */;
|
|
3162
|
+
return "Android" /* BrowserName.ANDROID */;
|
|
3166
3163
|
}
|
|
3167
3164
|
else {
|
|
3168
3165
|
// Most modern browsers have name/version at end of user agent string.
|
|
@@ -3172,7 +3169,7 @@ function _getBrowserName(userAgent) {
|
|
|
3172
3169
|
return matches[1];
|
|
3173
3170
|
}
|
|
3174
3171
|
}
|
|
3175
|
-
return "Other" /* OTHER */;
|
|
3172
|
+
return "Other" /* BrowserName.OTHER */;
|
|
3176
3173
|
}
|
|
3177
3174
|
function _isFirefox(ua) {
|
|
3178
3175
|
if (ua === void 0) { ua = getUA(); }
|
|
@@ -3268,15 +3265,15 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
3268
3265
|
if (frameworks === void 0) { frameworks = []; }
|
|
3269
3266
|
var reportedPlatform;
|
|
3270
3267
|
switch (clientPlatform) {
|
|
3271
|
-
case "Browser" /* BROWSER */:
|
|
3268
|
+
case "Browser" /* ClientPlatform.BROWSER */:
|
|
3272
3269
|
// In a browser environment, report the browser name.
|
|
3273
3270
|
reportedPlatform = _getBrowserName(getUA());
|
|
3274
3271
|
break;
|
|
3275
|
-
case "Worker" /* WORKER */:
|
|
3272
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
3276
3273
|
// Technically a worker runs from a browser but we need to differentiate a
|
|
3277
3274
|
// worker from a browser.
|
|
3278
3275
|
// For example: Chrome-Worker/JsCore/4.9.1/FirebaseCore-web.
|
|
3279
|
-
reportedPlatform = _getBrowserName(getUA())
|
|
3276
|
+
reportedPlatform = "".concat(_getBrowserName(getUA()), "-").concat(clientPlatform);
|
|
3280
3277
|
break;
|
|
3281
3278
|
default:
|
|
3282
3279
|
reportedPlatform = clientPlatform;
|
|
@@ -3284,7 +3281,7 @@ function _getClientVersion(clientPlatform, frameworks) {
|
|
|
3284
3281
|
var reportedFrameworks = frameworks.length
|
|
3285
3282
|
? frameworks.join(',')
|
|
3286
3283
|
: 'FirebaseCore-web'; /* default value if no other framework is used */
|
|
3287
|
-
return reportedPlatform
|
|
3284
|
+
return "".concat(reportedPlatform, "/").concat("JsCore" /* ClientImplementation.CORE */, "/").concat(SDK_VERSION, "/").concat(reportedFrameworks);
|
|
3288
3285
|
}
|
|
3289
3286
|
|
|
3290
3287
|
/**
|
|
@@ -3337,43 +3334,42 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
3337
3334
|
};
|
|
3338
3335
|
};
|
|
3339
3336
|
AuthMiddlewareQueue.prototype.runMiddleware = function (nextUser) {
|
|
3340
|
-
var _a;
|
|
3341
3337
|
return __awaiter(this, void 0, void 0, function () {
|
|
3342
|
-
var onAbortStack, _i,
|
|
3343
|
-
return __generator(this, function (
|
|
3344
|
-
switch (
|
|
3338
|
+
var onAbortStack, _i, _a, beforeStateCallback, e_1, _b, onAbortStack_1, onAbort;
|
|
3339
|
+
return __generator(this, function (_c) {
|
|
3340
|
+
switch (_c.label) {
|
|
3345
3341
|
case 0:
|
|
3346
3342
|
if (this.auth.currentUser === nextUser) {
|
|
3347
3343
|
return [2 /*return*/];
|
|
3348
3344
|
}
|
|
3349
3345
|
onAbortStack = [];
|
|
3350
|
-
|
|
3346
|
+
_c.label = 1;
|
|
3351
3347
|
case 1:
|
|
3352
|
-
|
|
3353
|
-
_i = 0,
|
|
3354
|
-
|
|
3348
|
+
_c.trys.push([1, 6, , 7]);
|
|
3349
|
+
_i = 0, _a = this.queue;
|
|
3350
|
+
_c.label = 2;
|
|
3355
3351
|
case 2:
|
|
3356
|
-
if (!(_i <
|
|
3357
|
-
beforeStateCallback =
|
|
3352
|
+
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
3353
|
+
beforeStateCallback = _a[_i];
|
|
3358
3354
|
return [4 /*yield*/, beforeStateCallback(nextUser)];
|
|
3359
3355
|
case 3:
|
|
3360
|
-
|
|
3356
|
+
_c.sent();
|
|
3361
3357
|
// Only push the onAbort if the callback succeeds
|
|
3362
3358
|
if (beforeStateCallback.onAbort) {
|
|
3363
3359
|
onAbortStack.push(beforeStateCallback.onAbort);
|
|
3364
3360
|
}
|
|
3365
|
-
|
|
3361
|
+
_c.label = 4;
|
|
3366
3362
|
case 4:
|
|
3367
3363
|
_i++;
|
|
3368
3364
|
return [3 /*break*/, 2];
|
|
3369
3365
|
case 5: return [3 /*break*/, 7];
|
|
3370
3366
|
case 6:
|
|
3371
|
-
e_1 =
|
|
3367
|
+
e_1 = _c.sent();
|
|
3372
3368
|
// Run all onAbort, with separate try/catch to ignore any errors and
|
|
3373
3369
|
// continue
|
|
3374
3370
|
onAbortStack.reverse();
|
|
3375
|
-
for (
|
|
3376
|
-
onAbort = onAbortStack_1[
|
|
3371
|
+
for (_b = 0, onAbortStack_1 = onAbortStack; _b < onAbortStack_1.length; _b++) {
|
|
3372
|
+
onAbort = onAbortStack_1[_b];
|
|
3377
3373
|
try {
|
|
3378
3374
|
onAbort();
|
|
3379
3375
|
}
|
|
@@ -3381,8 +3377,8 @@ var AuthMiddlewareQueue = /** @class */ (function () {
|
|
|
3381
3377
|
/* swallow error */
|
|
3382
3378
|
}
|
|
3383
3379
|
}
|
|
3384
|
-
throw this.auth._errorFactory.create("login-blocked" /* LOGIN_BLOCKED */, {
|
|
3385
|
-
originalMessage:
|
|
3380
|
+
throw this.auth._errorFactory.create("login-blocked" /* AuthErrorCode.LOGIN_BLOCKED */, {
|
|
3381
|
+
originalMessage: e_1 === null || e_1 === void 0 ? void 0 : e_1.message
|
|
3386
3382
|
});
|
|
3387
3383
|
case 7: return [2 /*return*/];
|
|
3388
3384
|
}
|
|
@@ -3592,7 +3588,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3592
3588
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
3593
3589
|
}
|
|
3594
3590
|
case 9:
|
|
3595
|
-
_assert(this._popupRedirectResolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
3591
|
+
_assert(this._popupRedirectResolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3596
3592
|
return [4 /*yield*/, this.getOrInitRedirectPersistenceManager()];
|
|
3597
3593
|
case 10:
|
|
3598
3594
|
_b.sent();
|
|
@@ -3640,21 +3636,20 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3640
3636
|
});
|
|
3641
3637
|
};
|
|
3642
3638
|
AuthImpl.prototype.reloadAndSetCurrentUserOrClear = function (user) {
|
|
3643
|
-
var _a;
|
|
3644
3639
|
return __awaiter(this, void 0, void 0, function () {
|
|
3645
3640
|
var e_4;
|
|
3646
|
-
return __generator(this, function (
|
|
3647
|
-
switch (
|
|
3641
|
+
return __generator(this, function (_a) {
|
|
3642
|
+
switch (_a.label) {
|
|
3648
3643
|
case 0:
|
|
3649
|
-
|
|
3644
|
+
_a.trys.push([0, 2, , 3]);
|
|
3650
3645
|
return [4 /*yield*/, _reloadWithoutSaving(user)];
|
|
3651
3646
|
case 1:
|
|
3652
|
-
|
|
3647
|
+
_a.sent();
|
|
3653
3648
|
return [3 /*break*/, 3];
|
|
3654
3649
|
case 2:
|
|
3655
|
-
e_4 =
|
|
3656
|
-
if ((
|
|
3657
|
-
"auth/"
|
|
3650
|
+
e_4 = _a.sent();
|
|
3651
|
+
if ((e_4 === null || e_4 === void 0 ? void 0 : e_4.code) !==
|
|
3652
|
+
"auth/".concat("network-request-failed" /* AuthErrorCode.NETWORK_REQUEST_FAILED */)) {
|
|
3658
3653
|
// Something's wrong with the user's token. Log them out and remove
|
|
3659
3654
|
// them from storage
|
|
3660
3655
|
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
@@ -3684,7 +3679,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3684
3679
|
? getModularInstance(userExtern)
|
|
3685
3680
|
: null;
|
|
3686
3681
|
if (user) {
|
|
3687
|
-
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* INVALID_AUTH */);
|
|
3682
|
+
_assert(user.auth.config.apiKey === this.config.apiKey, this, "invalid-user-token" /* AuthErrorCode.INVALID_AUTH */);
|
|
3688
3683
|
}
|
|
3689
3684
|
return [2 /*return*/, this._updateCurrentUser(user && user._clone(this))];
|
|
3690
3685
|
});
|
|
@@ -3701,7 +3696,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3701
3696
|
return [2 /*return*/];
|
|
3702
3697
|
}
|
|
3703
3698
|
if (user) {
|
|
3704
|
-
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
3699
|
+
_assert(this.tenantId === user.tenantId, this, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
3705
3700
|
}
|
|
3706
3701
|
if (!!skipBeforeStateCallbacks) return [3 /*break*/, 2];
|
|
3707
3702
|
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(user)];
|
|
@@ -3807,9 +3802,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3807
3802
|
if (!!this.redirectPersistenceManager) return [3 /*break*/, 3];
|
|
3808
3803
|
resolver = (popupRedirectResolver && _getInstance(popupRedirectResolver)) ||
|
|
3809
3804
|
this._popupRedirectResolver;
|
|
3810
|
-
_assert(resolver, this, "argument-error" /* ARGUMENT_ERROR */);
|
|
3805
|
+
_assert(resolver, this, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
3811
3806
|
_a = this;
|
|
3812
|
-
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* REDIRECT_USER */)];
|
|
3807
|
+
return [4 /*yield*/, PersistenceUserManager.create(this, [_getInstance(resolver._redirectPersistence)], "redirectUser" /* KeyName.REDIRECT_USER */)];
|
|
3813
3808
|
case 1:
|
|
3814
3809
|
_a.redirectPersistenceManager = _c.sent();
|
|
3815
3810
|
_b = this;
|
|
@@ -3869,7 +3864,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3869
3864
|
}
|
|
3870
3865
|
};
|
|
3871
3866
|
AuthImpl.prototype._key = function () {
|
|
3872
|
-
return this.config.authDomain
|
|
3867
|
+
return "".concat(this.config.authDomain, ":").concat(this.config.apiKey, ":").concat(this.name);
|
|
3873
3868
|
};
|
|
3874
3869
|
AuthImpl.prototype._startProactiveRefresh = function () {
|
|
3875
3870
|
this.isProactiveRefreshEnabled = true;
|
|
@@ -3914,7 +3909,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3914
3909
|
var promise = this._isInitialized
|
|
3915
3910
|
? Promise.resolve()
|
|
3916
3911
|
: this._initializationPromise;
|
|
3917
|
-
_assert(promise, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3912
|
+
_assert(promise, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3918
3913
|
// The callback needs to be called asynchronously per the spec.
|
|
3919
3914
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3920
3915
|
promise.then(function () { return cb(_this.currentUser); });
|
|
@@ -3964,7 +3959,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3964
3959
|
};
|
|
3965
3960
|
Object.defineProperty(AuthImpl.prototype, "assertedPersistence", {
|
|
3966
3961
|
get: function () {
|
|
3967
|
-
_assert(this.persistenceManager, this, "internal-error" /* INTERNAL_ERROR */);
|
|
3962
|
+
_assert(this.persistenceManager, this, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
3968
3963
|
return this.persistenceManager;
|
|
3969
3964
|
},
|
|
3970
3965
|
enumerable: false,
|
|
@@ -3992,10 +3987,10 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3992
3987
|
switch (_c.label) {
|
|
3993
3988
|
case 0:
|
|
3994
3989
|
headers = (_b = {},
|
|
3995
|
-
_b["X-Client-Version" /* X_CLIENT_VERSION */] = this.clientVersion,
|
|
3990
|
+
_b["X-Client-Version" /* HttpHeader.X_CLIENT_VERSION */] = this.clientVersion,
|
|
3996
3991
|
_b);
|
|
3997
3992
|
if (this.app.options.appId) {
|
|
3998
|
-
headers["X-Firebase-gmpid" /* X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3993
|
+
headers["X-Firebase-gmpid" /* HttpHeader.X_FIREBASE_GMPID */] = this.app.options.appId;
|
|
3999
3994
|
}
|
|
4000
3995
|
return [4 /*yield*/, ((_a = this.heartbeatServiceProvider
|
|
4001
3996
|
.getImmediate({
|
|
@@ -4004,7 +3999,7 @@ var AuthImpl = /** @class */ (function () {
|
|
|
4004
3999
|
case 1:
|
|
4005
4000
|
heartbeatsHeader = _c.sent();
|
|
4006
4001
|
if (heartbeatsHeader) {
|
|
4007
|
-
headers["X-Firebase-Client" /* X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
4002
|
+
headers["X-Firebase-Client" /* HttpHeader.X_FIREBASE_CLIENT */] = heartbeatsHeader;
|
|
4008
4003
|
}
|
|
4009
4004
|
return [2 /*return*/, headers];
|
|
4010
4005
|
}
|
|
@@ -4032,7 +4027,7 @@ var Subscription = /** @class */ (function () {
|
|
|
4032
4027
|
}
|
|
4033
4028
|
Object.defineProperty(Subscription.prototype, "next", {
|
|
4034
4029
|
get: function () {
|
|
4035
|
-
_assert(this.observer, this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4030
|
+
_assert(this.observer, this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4036
4031
|
return this.observer.next.bind(this.observer);
|
|
4037
4032
|
},
|
|
4038
4033
|
enumerable: false,
|
|
@@ -4065,14 +4060,14 @@ var Subscription = /** @class */ (function () {
|
|
|
4065
4060
|
*/
|
|
4066
4061
|
function connectAuthEmulator(auth, url, options) {
|
|
4067
4062
|
var authInternal = _castAuth(auth);
|
|
4068
|
-
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* EMULATOR_CONFIG_FAILED */);
|
|
4069
|
-
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* INVALID_EMULATOR_SCHEME */);
|
|
4063
|
+
_assert(authInternal._canInitEmulator, authInternal, "emulator-config-failed" /* AuthErrorCode.EMULATOR_CONFIG_FAILED */);
|
|
4064
|
+
_assert(/^https?:\/\//.test(url), authInternal, "invalid-emulator-scheme" /* AuthErrorCode.INVALID_EMULATOR_SCHEME */);
|
|
4070
4065
|
var disableWarnings = !!(options === null || options === void 0 ? void 0 : options.disableWarnings);
|
|
4071
4066
|
var protocol = extractProtocol(url);
|
|
4072
4067
|
var _a = extractHostAndPort(url), host = _a.host, port = _a.port;
|
|
4073
|
-
var portStr = port === null ? '' : ":"
|
|
4068
|
+
var portStr = port === null ? '' : ":".concat(port);
|
|
4074
4069
|
// Always replace path with "/" (even if input url had no path at all, or had a different one).
|
|
4075
|
-
authInternal.config.emulator = { url: protocol
|
|
4070
|
+
authInternal.config.emulator = { url: "".concat(protocol, "//").concat(host).concat(portStr, "/") };
|
|
4076
4071
|
authInternal.settings.appVerificationDisabledForTesting = true;
|
|
4077
4072
|
authInternal.emulatorConfig = Object.freeze({
|
|
4078
4073
|
host: host,
|
|
@@ -4237,21 +4232,21 @@ var AuthCredential = /** @class */ (function () {
|
|
|
4237
4232
|
function resetPassword(auth, request) {
|
|
4238
4233
|
return __awaiter(this, void 0, void 0, function () {
|
|
4239
4234
|
return __generator(this, function (_a) {
|
|
4240
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:resetPassword" /* RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4235
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:resetPassword" /* Endpoint.RESET_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4241
4236
|
});
|
|
4242
4237
|
});
|
|
4243
4238
|
}
|
|
4244
4239
|
function updateEmailPassword(auth, request) {
|
|
4245
4240
|
return __awaiter(this, void 0, void 0, function () {
|
|
4246
4241
|
return __generator(this, function (_a) {
|
|
4247
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
4242
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
4248
4243
|
});
|
|
4249
4244
|
});
|
|
4250
4245
|
}
|
|
4251
4246
|
function applyActionCode$1(auth, request) {
|
|
4252
4247
|
return __awaiter(this, void 0, void 0, function () {
|
|
4253
4248
|
return __generator(this, function (_a) {
|
|
4254
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
4249
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, _addTidIfNecessary(auth, request))];
|
|
4255
4250
|
});
|
|
4256
4251
|
});
|
|
4257
4252
|
}
|
|
@@ -4275,14 +4270,14 @@ function applyActionCode$1(auth, request) {
|
|
|
4275
4270
|
function signInWithPassword(auth, request) {
|
|
4276
4271
|
return __awaiter(this, void 0, void 0, function () {
|
|
4277
4272
|
return __generator(this, function (_a) {
|
|
4278
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPassword" /* SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4273
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */, _addTidIfNecessary(auth, request))];
|
|
4279
4274
|
});
|
|
4280
4275
|
});
|
|
4281
4276
|
}
|
|
4282
4277
|
function sendOobCode(auth, request) {
|
|
4283
4278
|
return __awaiter(this, void 0, void 0, function () {
|
|
4284
4279
|
return __generator(this, function (_a) {
|
|
4285
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendOobCode" /* SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
4280
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendOobCode" /* Endpoint.SEND_OOB_CODE */, _addTidIfNecessary(auth, request))];
|
|
4286
4281
|
});
|
|
4287
4282
|
});
|
|
4288
4283
|
}
|
|
@@ -4334,14 +4329,14 @@ function verifyAndChangeEmail(auth, request) {
|
|
|
4334
4329
|
function signInWithEmailLink$1(auth, request) {
|
|
4335
4330
|
return __awaiter(this, void 0, void 0, function () {
|
|
4336
4331
|
return __generator(this, function (_a) {
|
|
4337
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4332
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4338
4333
|
});
|
|
4339
4334
|
});
|
|
4340
4335
|
}
|
|
4341
4336
|
function signInWithEmailLinkForLinking(auth, request) {
|
|
4342
4337
|
return __awaiter(this, void 0, void 0, function () {
|
|
4343
4338
|
return __generator(this, function (_a) {
|
|
4344
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithEmailLink" /* SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4339
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */, _addTidIfNecessary(auth, request))];
|
|
4345
4340
|
});
|
|
4346
4341
|
});
|
|
4347
4342
|
}
|
|
@@ -4383,7 +4378,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4383
4378
|
/** @internal */
|
|
4384
4379
|
_tenantId) {
|
|
4385
4380
|
if (_tenantId === void 0) { _tenantId = null; }
|
|
4386
|
-
var _this = _super.call(this, "password" /* PASSWORD */, signInMethod) || this;
|
|
4381
|
+
var _this = _super.call(this, "password" /* ProviderId.PASSWORD */, signInMethod) || this;
|
|
4387
4382
|
_this._email = _email;
|
|
4388
4383
|
_this._password = _password;
|
|
4389
4384
|
_this._tenantId = _tenantId;
|
|
@@ -4391,12 +4386,12 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4391
4386
|
}
|
|
4392
4387
|
/** @internal */
|
|
4393
4388
|
EmailAuthCredential._fromEmailAndPassword = function (email, password) {
|
|
4394
|
-
return new EmailAuthCredential(email, password, "password" /* EMAIL_PASSWORD */);
|
|
4389
|
+
return new EmailAuthCredential(email, password, "password" /* SignInMethod.EMAIL_PASSWORD */);
|
|
4395
4390
|
};
|
|
4396
4391
|
/** @internal */
|
|
4397
4392
|
EmailAuthCredential._fromEmailAndCode = function (email, oobCode, tenantId) {
|
|
4398
4393
|
if (tenantId === void 0) { tenantId = null; }
|
|
4399
|
-
return new EmailAuthCredential(email, oobCode, "emailLink" /* EMAIL_LINK */, tenantId);
|
|
4394
|
+
return new EmailAuthCredential(email, oobCode, "emailLink" /* SignInMethod.EMAIL_LINK */, tenantId);
|
|
4400
4395
|
};
|
|
4401
4396
|
/** {@inheritdoc AuthCredential.toJSON} */
|
|
4402
4397
|
EmailAuthCredential.prototype.toJSON = function () {
|
|
@@ -4418,10 +4413,10 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4418
4413
|
EmailAuthCredential.fromJSON = function (json) {
|
|
4419
4414
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
4420
4415
|
if ((obj === null || obj === void 0 ? void 0 : obj.email) && (obj === null || obj === void 0 ? void 0 : obj.password)) {
|
|
4421
|
-
if (obj.signInMethod === "password" /* EMAIL_PASSWORD */) {
|
|
4416
|
+
if (obj.signInMethod === "password" /* SignInMethod.EMAIL_PASSWORD */) {
|
|
4422
4417
|
return this._fromEmailAndPassword(obj.email, obj.password);
|
|
4423
4418
|
}
|
|
4424
|
-
else if (obj.signInMethod === "emailLink" /* EMAIL_LINK */) {
|
|
4419
|
+
else if (obj.signInMethod === "emailLink" /* SignInMethod.EMAIL_LINK */) {
|
|
4425
4420
|
return this._fromEmailAndCode(obj.email, obj.password, obj.tenantId);
|
|
4426
4421
|
}
|
|
4427
4422
|
}
|
|
@@ -4432,19 +4427,19 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4432
4427
|
return __awaiter(this, void 0, void 0, function () {
|
|
4433
4428
|
return __generator(this, function (_a) {
|
|
4434
4429
|
switch (this.signInMethod) {
|
|
4435
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
4430
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
4436
4431
|
return [2 /*return*/, signInWithPassword(auth, {
|
|
4437
4432
|
returnSecureToken: true,
|
|
4438
4433
|
email: this._email,
|
|
4439
4434
|
password: this._password
|
|
4440
4435
|
})];
|
|
4441
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
4436
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
4442
4437
|
return [2 /*return*/, signInWithEmailLink$1(auth, {
|
|
4443
4438
|
email: this._email,
|
|
4444
4439
|
oobCode: this._password
|
|
4445
4440
|
})];
|
|
4446
4441
|
default:
|
|
4447
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4442
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4448
4443
|
}
|
|
4449
4444
|
return [2 /*return*/];
|
|
4450
4445
|
});
|
|
@@ -4455,21 +4450,21 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4455
4450
|
return __awaiter(this, void 0, void 0, function () {
|
|
4456
4451
|
return __generator(this, function (_a) {
|
|
4457
4452
|
switch (this.signInMethod) {
|
|
4458
|
-
case "password" /* EMAIL_PASSWORD */:
|
|
4453
|
+
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
4459
4454
|
return [2 /*return*/, updateEmailPassword(auth, {
|
|
4460
4455
|
idToken: idToken,
|
|
4461
4456
|
returnSecureToken: true,
|
|
4462
4457
|
email: this._email,
|
|
4463
4458
|
password: this._password
|
|
4464
4459
|
})];
|
|
4465
|
-
case "emailLink" /* EMAIL_LINK */:
|
|
4460
|
+
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
4466
4461
|
return [2 /*return*/, signInWithEmailLinkForLinking(auth, {
|
|
4467
4462
|
idToken: idToken,
|
|
4468
4463
|
email: this._email,
|
|
4469
4464
|
oobCode: this._password
|
|
4470
4465
|
})];
|
|
4471
4466
|
default:
|
|
4472
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
4467
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
4473
4468
|
}
|
|
4474
4469
|
return [2 /*return*/];
|
|
4475
4470
|
});
|
|
@@ -4501,7 +4496,7 @@ var EmailAuthCredential = /** @class */ (function (_super) {
|
|
|
4501
4496
|
function signInWithIdp(auth, request) {
|
|
4502
4497
|
return __awaiter(this, void 0, void 0, function () {
|
|
4503
4498
|
return __generator(this, function (_a) {
|
|
4504
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithIdp" /* SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
4499
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */, _addTidIfNecessary(auth, request))];
|
|
4505
4500
|
});
|
|
4506
4501
|
});
|
|
4507
4502
|
}
|
|
@@ -4563,7 +4558,7 @@ var OAuthCredential = /** @class */ (function (_super) {
|
|
|
4563
4558
|
cred.secret = params.oauthTokenSecret;
|
|
4564
4559
|
}
|
|
4565
4560
|
else {
|
|
4566
|
-
_fail("argument-error" /* ARGUMENT_ERROR */);
|
|
4561
|
+
_fail("argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4567
4562
|
}
|
|
4568
4563
|
return cred;
|
|
4569
4564
|
};
|
|
@@ -4669,14 +4664,14 @@ var _a;
|
|
|
4669
4664
|
function sendPhoneVerificationCode(auth, request) {
|
|
4670
4665
|
return __awaiter(this, void 0, void 0, function () {
|
|
4671
4666
|
return __generator(this, function (_a) {
|
|
4672
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:sendVerificationCode" /* SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
4667
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:sendVerificationCode" /* Endpoint.SEND_VERIFICATION_CODE */, _addTidIfNecessary(auth, request))];
|
|
4673
4668
|
});
|
|
4674
4669
|
});
|
|
4675
4670
|
}
|
|
4676
4671
|
function signInWithPhoneNumber(auth, request) {
|
|
4677
4672
|
return __awaiter(this, void 0, void 0, function () {
|
|
4678
4673
|
return __generator(this, function (_a) {
|
|
4679
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4674
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4680
4675
|
});
|
|
4681
4676
|
});
|
|
4682
4677
|
}
|
|
@@ -4685,11 +4680,11 @@ function linkWithPhoneNumber(auth, request) {
|
|
|
4685
4680
|
var response;
|
|
4686
4681
|
return __generator(this, function (_a) {
|
|
4687
4682
|
switch (_a.label) {
|
|
4688
|
-
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithPhoneNumber" /* SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4683
|
+
case 0: return [4 /*yield*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */, _addTidIfNecessary(auth, request))];
|
|
4689
4684
|
case 1:
|
|
4690
4685
|
response = _a.sent();
|
|
4691
4686
|
if (response.temporaryProof) {
|
|
4692
|
-
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* NEED_CONFIRMATION */, response);
|
|
4687
|
+
throw _makeTaggedError(auth, "account-exists-with-different-credential" /* AuthErrorCode.NEED_CONFIRMATION */, response);
|
|
4693
4688
|
}
|
|
4694
4689
|
return [2 /*return*/, response];
|
|
4695
4690
|
}
|
|
@@ -4697,14 +4692,14 @@ function linkWithPhoneNumber(auth, request) {
|
|
|
4697
4692
|
});
|
|
4698
4693
|
}
|
|
4699
4694
|
var VERIFY_PHONE_NUMBER_FOR_EXISTING_ERROR_MAP_ = (_a = {},
|
|
4700
|
-
_a["USER_NOT_FOUND" /* USER_NOT_FOUND */] = "user-not-found" /* USER_DELETED */,
|
|
4695
|
+
_a["USER_NOT_FOUND" /* ServerError.USER_NOT_FOUND */] = "user-not-found" /* AuthErrorCode.USER_DELETED */,
|
|
4701
4696
|
_a);
|
|
4702
4697
|
function verifyPhoneNumberForExisting(auth, request) {
|
|
4703
4698
|
return __awaiter(this, void 0, void 0, function () {
|
|
4704
4699
|
var apiRequest;
|
|
4705
4700
|
return __generator(this, function (_a) {
|
|
4706
4701
|
apiRequest = __assign(__assign({}, request), { operation: 'REAUTH' });
|
|
4707
|
-
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_)];
|
|
4702
|
+
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_)];
|
|
4708
4703
|
});
|
|
4709
4704
|
});
|
|
4710
4705
|
}
|
|
@@ -4733,7 +4728,7 @@ function verifyPhoneNumberForExisting(auth, request) {
|
|
|
4733
4728
|
var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
4734
4729
|
__extends(PhoneAuthCredential, _super);
|
|
4735
4730
|
function PhoneAuthCredential(params) {
|
|
4736
|
-
var _this = _super.call(this, "phone" /* PHONE */, "phone" /* PHONE */) || this;
|
|
4731
|
+
var _this = _super.call(this, "phone" /* ProviderId.PHONE */, "phone" /* SignInMethod.PHONE */) || this;
|
|
4737
4732
|
_this.params = params;
|
|
4738
4733
|
return _this;
|
|
4739
4734
|
}
|
|
@@ -4833,17 +4828,17 @@ var PhoneAuthCredential = /** @class */ (function (_super) {
|
|
|
4833
4828
|
function parseMode(mode) {
|
|
4834
4829
|
switch (mode) {
|
|
4835
4830
|
case 'recoverEmail':
|
|
4836
|
-
return "RECOVER_EMAIL" /* RECOVER_EMAIL */;
|
|
4831
|
+
return "RECOVER_EMAIL" /* ActionCodeOperation.RECOVER_EMAIL */;
|
|
4837
4832
|
case 'resetPassword':
|
|
4838
|
-
return "PASSWORD_RESET" /* PASSWORD_RESET */;
|
|
4833
|
+
return "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */;
|
|
4839
4834
|
case 'signIn':
|
|
4840
|
-
return "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
4835
|
+
return "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
4841
4836
|
case 'verifyEmail':
|
|
4842
|
-
return "VERIFY_EMAIL" /* VERIFY_EMAIL */;
|
|
4837
|
+
return "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */;
|
|
4843
4838
|
case 'verifyAndChangeEmail':
|
|
4844
|
-
return "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */;
|
|
4839
|
+
return "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */;
|
|
4845
4840
|
case 'revertSecondFactorAddition':
|
|
4846
|
-
return "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */;
|
|
4841
|
+
return "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */;
|
|
4847
4842
|
default:
|
|
4848
4843
|
return null;
|
|
4849
4844
|
}
|
|
@@ -4882,17 +4877,17 @@ var ActionCodeURL = /** @class */ (function () {
|
|
|
4882
4877
|
function ActionCodeURL(actionLink) {
|
|
4883
4878
|
var _a, _b, _c, _d, _e, _f;
|
|
4884
4879
|
var searchParams = querystringDecode(extractQuerystring(actionLink));
|
|
4885
|
-
var apiKey = (_a = searchParams["apiKey" /* API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4886
|
-
var code = (_b = searchParams["oobCode" /* CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4887
|
-
var operation = parseMode((_c = searchParams["mode" /* MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4880
|
+
var apiKey = (_a = searchParams["apiKey" /* QueryField.API_KEY */]) !== null && _a !== void 0 ? _a : null;
|
|
4881
|
+
var code = (_b = searchParams["oobCode" /* QueryField.CODE */]) !== null && _b !== void 0 ? _b : null;
|
|
4882
|
+
var operation = parseMode((_c = searchParams["mode" /* QueryField.MODE */]) !== null && _c !== void 0 ? _c : null);
|
|
4888
4883
|
// Validate API key, code and mode.
|
|
4889
|
-
_assert(apiKey && code && operation, "argument-error" /* ARGUMENT_ERROR */);
|
|
4884
|
+
_assert(apiKey && code && operation, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
4890
4885
|
this.apiKey = apiKey;
|
|
4891
4886
|
this.operation = operation;
|
|
4892
4887
|
this.code = code;
|
|
4893
|
-
this.continueUrl = (_d = searchParams["continueUrl" /* CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4894
|
-
this.languageCode = (_e = searchParams["languageCode" /* LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4895
|
-
this.tenantId = (_f = searchParams["tenantId" /* TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4888
|
+
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4889
|
+
this.languageCode = (_e = searchParams["languageCode" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4890
|
+
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4896
4891
|
}
|
|
4897
4892
|
/**
|
|
4898
4893
|
* Parses the email action link string and returns an {@link ActionCodeURL} if the link is valid,
|
|
@@ -4997,21 +4992,21 @@ var EmailAuthProvider = /** @class */ (function () {
|
|
|
4997
4992
|
*/
|
|
4998
4993
|
EmailAuthProvider.credentialWithLink = function (email, emailLink) {
|
|
4999
4994
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
5000
|
-
_assert(actionCodeUrl, "argument-error" /* ARGUMENT_ERROR */);
|
|
4995
|
+
_assert(actionCodeUrl, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5001
4996
|
return EmailAuthCredential._fromEmailAndCode(email, actionCodeUrl.code, actionCodeUrl.tenantId);
|
|
5002
4997
|
};
|
|
5003
4998
|
/**
|
|
5004
4999
|
* Always set to {@link ProviderId}.PASSWORD, even for email link.
|
|
5005
5000
|
*/
|
|
5006
|
-
EmailAuthProvider.PROVIDER_ID = "password" /* PASSWORD */;
|
|
5001
|
+
EmailAuthProvider.PROVIDER_ID = "password" /* ProviderId.PASSWORD */;
|
|
5007
5002
|
/**
|
|
5008
5003
|
* Always set to {@link SignInMethod}.EMAIL_PASSWORD.
|
|
5009
5004
|
*/
|
|
5010
|
-
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* EMAIL_PASSWORD */;
|
|
5005
|
+
EmailAuthProvider.EMAIL_PASSWORD_SIGN_IN_METHOD = "password" /* SignInMethod.EMAIL_PASSWORD */;
|
|
5011
5006
|
/**
|
|
5012
5007
|
* Always set to {@link SignInMethod}.EMAIL_LINK.
|
|
5013
5008
|
*/
|
|
5014
|
-
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* EMAIL_LINK */;
|
|
5009
|
+
EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD = "emailLink" /* SignInMethod.EMAIL_LINK */;
|
|
5015
5010
|
return EmailAuthProvider;
|
|
5016
5011
|
}());
|
|
5017
5012
|
|
|
@@ -5128,7 +5123,7 @@ var BaseOAuthProvider = /** @class */ (function (_super) {
|
|
|
5128
5123
|
* Retrieve the current list of OAuth scopes.
|
|
5129
5124
|
*/
|
|
5130
5125
|
BaseOAuthProvider.prototype.getScopes = function () {
|
|
5131
|
-
return __spreadArray([], this.scopes);
|
|
5126
|
+
return __spreadArray([], this.scopes, true);
|
|
5132
5127
|
};
|
|
5133
5128
|
return BaseOAuthProvider;
|
|
5134
5129
|
}(FederatedAuthProvider));
|
|
@@ -5183,7 +5178,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5183
5178
|
*/
|
|
5184
5179
|
OAuthProvider.credentialFromJSON = function (json) {
|
|
5185
5180
|
var obj = typeof json === 'string' ? JSON.parse(json) : json;
|
|
5186
|
-
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* ARGUMENT_ERROR */);
|
|
5181
|
+
_assert('providerId' in obj && 'signInMethod' in obj, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5187
5182
|
return OAuthCredential._fromParams(obj);
|
|
5188
5183
|
};
|
|
5189
5184
|
/**
|
|
@@ -5212,7 +5207,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5212
5207
|
};
|
|
5213
5208
|
/** An internal credential method that accepts more permissive options */
|
|
5214
5209
|
OAuthProvider.prototype._credential = function (params) {
|
|
5215
|
-
_assert(params.idToken || params.accessToken, "argument-error" /* ARGUMENT_ERROR */);
|
|
5210
|
+
_assert(params.idToken || params.accessToken, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5216
5211
|
// For OAuthCredential, sign in method is same as providerId.
|
|
5217
5212
|
return OAuthCredential._fromParams(__assign(__assign({}, params), { providerId: this.providerId, signInMethod: this.providerId }));
|
|
5218
5213
|
};
|
|
@@ -5321,7 +5316,7 @@ var OAuthProvider = /** @class */ (function (_super) {
|
|
|
5321
5316
|
var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
5322
5317
|
__extends(FacebookAuthProvider, _super);
|
|
5323
5318
|
function FacebookAuthProvider() {
|
|
5324
|
-
return _super.call(this, "facebook.com" /* FACEBOOK */) || this;
|
|
5319
|
+
return _super.call(this, "facebook.com" /* ProviderId.FACEBOOK */) || this;
|
|
5325
5320
|
}
|
|
5326
5321
|
/**
|
|
5327
5322
|
* Creates a credential for Facebook.
|
|
@@ -5375,9 +5370,9 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
5375
5370
|
}
|
|
5376
5371
|
};
|
|
5377
5372
|
/** Always set to {@link SignInMethod}.FACEBOOK. */
|
|
5378
|
-
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* FACEBOOK */;
|
|
5373
|
+
FacebookAuthProvider.FACEBOOK_SIGN_IN_METHOD = "facebook.com" /* SignInMethod.FACEBOOK */;
|
|
5379
5374
|
/** Always set to {@link ProviderId}.FACEBOOK. */
|
|
5380
|
-
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* FACEBOOK */;
|
|
5375
|
+
FacebookAuthProvider.PROVIDER_ID = "facebook.com" /* ProviderId.FACEBOOK */;
|
|
5381
5376
|
return FacebookAuthProvider;
|
|
5382
5377
|
}(BaseOAuthProvider));
|
|
5383
5378
|
|
|
@@ -5441,7 +5436,7 @@ var FacebookAuthProvider = /** @class */ (function (_super) {
|
|
|
5441
5436
|
var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
5442
5437
|
__extends(GoogleAuthProvider, _super);
|
|
5443
5438
|
function GoogleAuthProvider() {
|
|
5444
|
-
var _this = _super.call(this, "google.com" /* GOOGLE */) || this;
|
|
5439
|
+
var _this = _super.call(this, "google.com" /* ProviderId.GOOGLE */) || this;
|
|
5445
5440
|
_this.addScope('profile');
|
|
5446
5441
|
return _this;
|
|
5447
5442
|
}
|
|
@@ -5501,9 +5496,9 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
5501
5496
|
}
|
|
5502
5497
|
};
|
|
5503
5498
|
/** Always set to {@link SignInMethod}.GOOGLE. */
|
|
5504
|
-
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* GOOGLE */;
|
|
5499
|
+
GoogleAuthProvider.GOOGLE_SIGN_IN_METHOD = "google.com" /* SignInMethod.GOOGLE */;
|
|
5505
5500
|
/** Always set to {@link ProviderId}.GOOGLE. */
|
|
5506
|
-
GoogleAuthProvider.PROVIDER_ID = "google.com" /* GOOGLE */;
|
|
5501
|
+
GoogleAuthProvider.PROVIDER_ID = "google.com" /* ProviderId.GOOGLE */;
|
|
5507
5502
|
return GoogleAuthProvider;
|
|
5508
5503
|
}(BaseOAuthProvider));
|
|
5509
5504
|
|
|
@@ -5568,7 +5563,7 @@ var GoogleAuthProvider = /** @class */ (function (_super) {
|
|
|
5568
5563
|
var GithubAuthProvider = /** @class */ (function (_super) {
|
|
5569
5564
|
__extends(GithubAuthProvider, _super);
|
|
5570
5565
|
function GithubAuthProvider() {
|
|
5571
|
-
return _super.call(this, "github.com" /* GITHUB */) || this;
|
|
5566
|
+
return _super.call(this, "github.com" /* ProviderId.GITHUB */) || this;
|
|
5572
5567
|
}
|
|
5573
5568
|
/**
|
|
5574
5569
|
* Creates a credential for Github.
|
|
@@ -5615,9 +5610,9 @@ var GithubAuthProvider = /** @class */ (function (_super) {
|
|
|
5615
5610
|
}
|
|
5616
5611
|
};
|
|
5617
5612
|
/** Always set to {@link SignInMethod}.GITHUB. */
|
|
5618
|
-
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* GITHUB */;
|
|
5613
|
+
GithubAuthProvider.GITHUB_SIGN_IN_METHOD = "github.com" /* SignInMethod.GITHUB */;
|
|
5619
5614
|
/** Always set to {@link ProviderId}.GITHUB. */
|
|
5620
|
-
GithubAuthProvider.PROVIDER_ID = "github.com" /* GITHUB */;
|
|
5615
|
+
GithubAuthProvider.PROVIDER_ID = "github.com" /* ProviderId.GITHUB */;
|
|
5621
5616
|
return GithubAuthProvider;
|
|
5622
5617
|
}(BaseOAuthProvider));
|
|
5623
5618
|
|
|
@@ -5741,10 +5736,8 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5741
5736
|
* @param providerId - SAML provider ID.
|
|
5742
5737
|
*/
|
|
5743
5738
|
function SAMLAuthProvider(providerId) {
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
_this = _super.call(this, providerId) || this;
|
|
5747
|
-
return _this;
|
|
5739
|
+
_assert(providerId.startsWith(SAML_PROVIDER_PREFIX), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5740
|
+
return _super.call(this, providerId) || this;
|
|
5748
5741
|
}
|
|
5749
5742
|
/**
|
|
5750
5743
|
* Generates an {@link AuthCredential} from a {@link UserCredential} after a
|
|
@@ -5780,7 +5773,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5780
5773
|
*/
|
|
5781
5774
|
SAMLAuthProvider.credentialFromJSON = function (json) {
|
|
5782
5775
|
var credential = SAMLAuthCredential.fromJSON(json);
|
|
5783
|
-
_assert(credential, "argument-error" /* ARGUMENT_ERROR */);
|
|
5776
|
+
_assert(credential, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
5784
5777
|
return credential;
|
|
5785
5778
|
};
|
|
5786
5779
|
SAMLAuthProvider.samlCredentialFromTaggedObject = function (_a) {
|
|
@@ -5860,7 +5853,7 @@ var SAMLAuthProvider = /** @class */ (function (_super) {
|
|
|
5860
5853
|
var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
5861
5854
|
__extends(TwitterAuthProvider, _super);
|
|
5862
5855
|
function TwitterAuthProvider() {
|
|
5863
|
-
return _super.call(this, "twitter.com" /* TWITTER */) || this;
|
|
5856
|
+
return _super.call(this, "twitter.com" /* ProviderId.TWITTER */) || this;
|
|
5864
5857
|
}
|
|
5865
5858
|
/**
|
|
5866
5859
|
* Creates a credential for Twitter.
|
|
@@ -5910,9 +5903,9 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5910
5903
|
}
|
|
5911
5904
|
};
|
|
5912
5905
|
/** Always set to {@link SignInMethod}.TWITTER. */
|
|
5913
|
-
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* TWITTER */;
|
|
5906
|
+
TwitterAuthProvider.TWITTER_SIGN_IN_METHOD = "twitter.com" /* SignInMethod.TWITTER */;
|
|
5914
5907
|
/** Always set to {@link ProviderId}.TWITTER. */
|
|
5915
|
-
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* TWITTER */;
|
|
5908
|
+
TwitterAuthProvider.PROVIDER_ID = "twitter.com" /* ProviderId.TWITTER */;
|
|
5916
5909
|
return TwitterAuthProvider;
|
|
5917
5910
|
}(BaseOAuthProvider));
|
|
5918
5911
|
|
|
@@ -5935,7 +5928,7 @@ var TwitterAuthProvider = /** @class */ (function (_super) {
|
|
|
5935
5928
|
function signUp(auth, request) {
|
|
5936
5929
|
return __awaiter(this, void 0, void 0, function () {
|
|
5937
5930
|
return __generator(this, function (_a) {
|
|
5938
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signUp" /* SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5931
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signUp" /* Endpoint.SIGN_UP */, _addTidIfNecessary(auth, request))];
|
|
5939
5932
|
});
|
|
5940
5933
|
});
|
|
5941
5934
|
}
|
|
@@ -6010,7 +6003,7 @@ function providerIdForResponse(response) {
|
|
|
6010
6003
|
return response.providerId;
|
|
6011
6004
|
}
|
|
6012
6005
|
if ('phoneNumber' in response) {
|
|
6013
|
-
return "phone" /* PHONE */;
|
|
6006
|
+
return "phone" /* ProviderId.PHONE */;
|
|
6014
6007
|
}
|
|
6015
6008
|
return null;
|
|
6016
6009
|
}
|
|
@@ -6058,7 +6051,7 @@ function signInAnonymously(auth) {
|
|
|
6058
6051
|
return [2 /*return*/, new UserCredentialImpl({
|
|
6059
6052
|
user: authInternal.currentUser,
|
|
6060
6053
|
providerId: null,
|
|
6061
|
-
operationType: "signIn" /* SIGN_IN */
|
|
6054
|
+
operationType: "signIn" /* OperationType.SIGN_IN */
|
|
6062
6055
|
})];
|
|
6063
6056
|
}
|
|
6064
6057
|
return [4 /*yield*/, signUp(authInternal, {
|
|
@@ -6066,7 +6059,7 @@ function signInAnonymously(auth) {
|
|
|
6066
6059
|
})];
|
|
6067
6060
|
case 2:
|
|
6068
6061
|
response = _b.sent();
|
|
6069
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response, true)];
|
|
6062
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response, true)];
|
|
6070
6063
|
case 3:
|
|
6071
6064
|
userCredential = _b.sent();
|
|
6072
6065
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -6097,8 +6090,9 @@ function signInAnonymously(auth) {
|
|
|
6097
6090
|
var MultiFactorError = /** @class */ (function (_super) {
|
|
6098
6091
|
__extends(MultiFactorError, _super);
|
|
6099
6092
|
function MultiFactorError(auth, error, operationType, user) {
|
|
6093
|
+
var _this = this;
|
|
6100
6094
|
var _a;
|
|
6101
|
-
|
|
6095
|
+
_this = _super.call(this, error.code, error.message) || this;
|
|
6102
6096
|
_this.operationType = operationType;
|
|
6103
6097
|
_this.user = user;
|
|
6104
6098
|
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
|
|
@@ -6117,11 +6111,11 @@ var MultiFactorError = /** @class */ (function (_super) {
|
|
|
6117
6111
|
return MultiFactorError;
|
|
6118
6112
|
}(FirebaseError));
|
|
6119
6113
|
function _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user) {
|
|
6120
|
-
var idTokenProvider = operationType === "reauthenticate" /* REAUTHENTICATE */
|
|
6114
|
+
var idTokenProvider = operationType === "reauthenticate" /* OperationType.REAUTHENTICATE */
|
|
6121
6115
|
? credential._getReauthenticationResolver(auth)
|
|
6122
6116
|
: credential._getIdTokenResponse(auth);
|
|
6123
6117
|
return idTokenProvider.catch(function (error) {
|
|
6124
|
-
if (error.code === "auth/"
|
|
6118
|
+
if (error.code === "auth/".concat("multi-factor-auth-required" /* AuthErrorCode.MFA_REQUIRED */)) {
|
|
6125
6119
|
throw MultiFactorError._fromErrorAndOperation(auth, error, operationType, user);
|
|
6126
6120
|
}
|
|
6127
6121
|
throw error;
|
|
@@ -6204,7 +6198,7 @@ function unlink(user, providerId) {
|
|
|
6204
6198
|
userInternal.providerData = userInternal.providerData.filter(function (pd) {
|
|
6205
6199
|
return providersLeft.has(pd.providerId);
|
|
6206
6200
|
});
|
|
6207
|
-
if (!providersLeft.has("phone" /* PHONE */)) {
|
|
6201
|
+
if (!providersLeft.has("phone" /* ProviderId.PHONE */)) {
|
|
6208
6202
|
userInternal.phoneNumber = null;
|
|
6209
6203
|
}
|
|
6210
6204
|
return [4 /*yield*/, userInternal.auth._persistUserIfCurrent(userInternal)];
|
|
@@ -6227,10 +6221,11 @@ function _link$1(user, credential, bypassAuthState) {
|
|
|
6227
6221
|
_d = (_c = credential)._linkToIdToken;
|
|
6228
6222
|
_e = [user.auth];
|
|
6229
6223
|
return [4 /*yield*/, user.getIdToken()];
|
|
6230
|
-
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
6224
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, _b.concat([_d.apply(_c, _e.concat([_f.sent()])),
|
|
6225
|
+
bypassAuthState]))];
|
|
6231
6226
|
case 2:
|
|
6232
6227
|
response = _f.sent();
|
|
6233
|
-
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* LINK */, response)];
|
|
6228
|
+
return [2 /*return*/, UserCredentialImpl._forOperation(user, "link" /* OperationType.LINK */, response)];
|
|
6234
6229
|
}
|
|
6235
6230
|
});
|
|
6236
6231
|
});
|
|
@@ -6245,8 +6240,8 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
6245
6240
|
_a.sent();
|
|
6246
6241
|
providerIds = providerDataAsNames(user.providerData);
|
|
6247
6242
|
code = expected === false
|
|
6248
|
-
? "provider-already-linked" /* PROVIDER_ALREADY_LINKED */
|
|
6249
|
-
: "no-such-provider" /* NO_SUCH_PROVIDER */;
|
|
6243
|
+
? "provider-already-linked" /* AuthErrorCode.PROVIDER_ALREADY_LINKED */
|
|
6244
|
+
: "no-such-provider" /* AuthErrorCode.NO_SUCH_PROVIDER */;
|
|
6250
6245
|
_assert(providerIds.has(provider) === expected, user.auth, code);
|
|
6251
6246
|
return [2 /*return*/];
|
|
6252
6247
|
}
|
|
@@ -6271,32 +6266,31 @@ function _assertLinkedStatus(expected, user, provider) {
|
|
|
6271
6266
|
* limitations under the License.
|
|
6272
6267
|
*/
|
|
6273
6268
|
function _reauthenticate(user, credential, bypassAuthState) {
|
|
6274
|
-
var _a;
|
|
6275
6269
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
6276
6270
|
return __awaiter(this, void 0, void 0, function () {
|
|
6277
6271
|
var auth, operationType, response, parsed, localId, e_1;
|
|
6278
|
-
return __generator(this, function (
|
|
6279
|
-
switch (
|
|
6272
|
+
return __generator(this, function (_a) {
|
|
6273
|
+
switch (_a.label) {
|
|
6280
6274
|
case 0:
|
|
6281
6275
|
auth = user.auth;
|
|
6282
|
-
operationType = "reauthenticate" /* REAUTHENTICATE */;
|
|
6283
|
-
|
|
6276
|
+
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
6277
|
+
_a.label = 1;
|
|
6284
6278
|
case 1:
|
|
6285
|
-
|
|
6279
|
+
_a.trys.push([1, 3, , 4]);
|
|
6286
6280
|
return [4 /*yield*/, _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState)];
|
|
6287
6281
|
case 2:
|
|
6288
|
-
response =
|
|
6289
|
-
_assert(response.idToken, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6282
|
+
response = _a.sent();
|
|
6283
|
+
_assert(response.idToken, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6290
6284
|
parsed = _parseToken(response.idToken);
|
|
6291
|
-
_assert(parsed, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6285
|
+
_assert(parsed, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6292
6286
|
localId = parsed.sub;
|
|
6293
|
-
_assert(user.uid === localId, auth, "user-mismatch" /* USER_MISMATCH */);
|
|
6287
|
+
_assert(user.uid === localId, auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
6294
6288
|
return [2 /*return*/, UserCredentialImpl._forOperation(user, operationType, response)];
|
|
6295
6289
|
case 3:
|
|
6296
|
-
e_1 =
|
|
6290
|
+
e_1 = _a.sent();
|
|
6297
6291
|
// Convert user deleted error into user mismatch
|
|
6298
|
-
if ((
|
|
6299
|
-
_fail(auth, "user-mismatch" /* USER_MISMATCH */);
|
|
6292
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) === "auth/".concat("user-not-found" /* AuthErrorCode.USER_DELETED */)) {
|
|
6293
|
+
_fail(auth, "user-mismatch" /* AuthErrorCode.USER_MISMATCH */);
|
|
6300
6294
|
}
|
|
6301
6295
|
throw e_1;
|
|
6302
6296
|
case 4: return [2 /*return*/];
|
|
@@ -6328,7 +6322,7 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6328
6322
|
return __generator(this, function (_a) {
|
|
6329
6323
|
switch (_a.label) {
|
|
6330
6324
|
case 0:
|
|
6331
|
-
operationType = "signIn" /* SIGN_IN */;
|
|
6325
|
+
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
6332
6326
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
6333
6327
|
case 1:
|
|
6334
6328
|
response = _a.sent();
|
|
@@ -6428,7 +6422,7 @@ function reauthenticateWithCredential(user, credential) {
|
|
|
6428
6422
|
function signInWithCustomToken$1(auth, request) {
|
|
6429
6423
|
return __awaiter(this, void 0, void 0, function () {
|
|
6430
6424
|
return __generator(this, function (_a) {
|
|
6431
|
-
return [2 /*return*/, _performSignInRequest(auth, "POST" /* POST */, "/v1/accounts:signInWithCustomToken" /* SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
6425
|
+
return [2 /*return*/, _performSignInRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */, _addTidIfNecessary(auth, request))];
|
|
6432
6426
|
});
|
|
6433
6427
|
});
|
|
6434
6428
|
}
|
|
@@ -6478,7 +6472,7 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
6478
6472
|
})];
|
|
6479
6473
|
case 1:
|
|
6480
6474
|
response = _a.sent();
|
|
6481
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
6475
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
6482
6476
|
case 2:
|
|
6483
6477
|
cred = _a.sent();
|
|
6484
6478
|
return [4 /*yield*/, authInternal._updateCurrentUser(cred.user)];
|
|
@@ -6517,14 +6511,14 @@ var MultiFactorInfoImpl = /** @class */ (function () {
|
|
|
6517
6511
|
if ('phoneInfo' in enrollment) {
|
|
6518
6512
|
return PhoneMultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
6519
6513
|
}
|
|
6520
|
-
return _fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
6514
|
+
return _fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6521
6515
|
};
|
|
6522
6516
|
return MultiFactorInfoImpl;
|
|
6523
6517
|
}());
|
|
6524
6518
|
var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
6525
6519
|
__extends(PhoneMultiFactorInfoImpl, _super);
|
|
6526
6520
|
function PhoneMultiFactorInfoImpl(response) {
|
|
6527
|
-
var _this = _super.call(this, "phone" /* PHONE */, response) || this;
|
|
6521
|
+
var _this = _super.call(this, "phone" /* FactorId.PHONE */, response) || this;
|
|
6528
6522
|
_this.phoneNumber = response.phoneInfo;
|
|
6529
6523
|
return _this;
|
|
6530
6524
|
}
|
|
@@ -6552,18 +6546,18 @@ var PhoneMultiFactorInfoImpl = /** @class */ (function (_super) {
|
|
|
6552
6546
|
*/
|
|
6553
6547
|
function _setActionCodeSettingsOnRequest(auth, request, actionCodeSettings) {
|
|
6554
6548
|
var _a;
|
|
6555
|
-
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* INVALID_CONTINUE_URI */);
|
|
6549
|
+
_assert(((_a = actionCodeSettings.url) === null || _a === void 0 ? void 0 : _a.length) > 0, auth, "invalid-continue-uri" /* AuthErrorCode.INVALID_CONTINUE_URI */);
|
|
6556
6550
|
_assert(typeof actionCodeSettings.dynamicLinkDomain === 'undefined' ||
|
|
6557
|
-
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
6551
|
+
actionCodeSettings.dynamicLinkDomain.length > 0, auth, "invalid-dynamic-link-domain" /* AuthErrorCode.INVALID_DYNAMIC_LINK_DOMAIN */);
|
|
6558
6552
|
request.continueUrl = actionCodeSettings.url;
|
|
6559
6553
|
request.dynamicLinkDomain = actionCodeSettings.dynamicLinkDomain;
|
|
6560
6554
|
request.canHandleCodeInApp = actionCodeSettings.handleCodeInApp;
|
|
6561
6555
|
if (actionCodeSettings.iOS) {
|
|
6562
|
-
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* MISSING_IOS_BUNDLE_ID */);
|
|
6556
|
+
_assert(actionCodeSettings.iOS.bundleId.length > 0, auth, "missing-ios-bundle-id" /* AuthErrorCode.MISSING_IOS_BUNDLE_ID */);
|
|
6563
6557
|
request.iOSBundleId = actionCodeSettings.iOS.bundleId;
|
|
6564
6558
|
}
|
|
6565
6559
|
if (actionCodeSettings.android) {
|
|
6566
|
-
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* MISSING_ANDROID_PACKAGE_NAME */);
|
|
6560
|
+
_assert(actionCodeSettings.android.packageName.length > 0, auth, "missing-android-pkg-name" /* AuthErrorCode.MISSING_ANDROID_PACKAGE_NAME */);
|
|
6567
6561
|
request.androidInstallApp = actionCodeSettings.android.installApp;
|
|
6568
6562
|
request.androidMinimumVersionCode =
|
|
6569
6563
|
actionCodeSettings.android.minimumVersion;
|
|
@@ -6627,7 +6621,7 @@ function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
|
6627
6621
|
case 0:
|
|
6628
6622
|
authModular = getModularInstance(auth);
|
|
6629
6623
|
request = {
|
|
6630
|
-
requestType: "PASSWORD_RESET" /* PASSWORD_RESET */,
|
|
6624
|
+
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
6631
6625
|
email: email
|
|
6632
6626
|
};
|
|
6633
6627
|
if (actionCodeSettings) {
|
|
@@ -6706,18 +6700,18 @@ function checkActionCode(auth, oobCode) {
|
|
|
6706
6700
|
case 1:
|
|
6707
6701
|
response = _a.sent();
|
|
6708
6702
|
operation = response.requestType;
|
|
6709
|
-
_assert(operation, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6703
|
+
_assert(operation, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6710
6704
|
switch (operation) {
|
|
6711
|
-
case "EMAIL_SIGNIN" /* EMAIL_SIGNIN */:
|
|
6705
|
+
case "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */:
|
|
6712
6706
|
break;
|
|
6713
|
-
case "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */:
|
|
6714
|
-
_assert(response.newEmail, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6707
|
+
case "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */:
|
|
6708
|
+
_assert(response.newEmail, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6715
6709
|
break;
|
|
6716
|
-
case "REVERT_SECOND_FACTOR_ADDITION" /* REVERT_SECOND_FACTOR_ADDITION */:
|
|
6717
|
-
_assert(response.mfaInfo, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6710
|
+
case "REVERT_SECOND_FACTOR_ADDITION" /* ActionCodeOperation.REVERT_SECOND_FACTOR_ADDITION */:
|
|
6711
|
+
_assert(response.mfaInfo, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6718
6712
|
// fall through
|
|
6719
6713
|
default:
|
|
6720
|
-
_assert(response.email, authModular, "internal-error" /* INTERNAL_ERROR */);
|
|
6714
|
+
_assert(response.email, authModular, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
6721
6715
|
}
|
|
6722
6716
|
multiFactorInfo = null;
|
|
6723
6717
|
if (response.mfaInfo) {
|
|
@@ -6725,10 +6719,10 @@ function checkActionCode(auth, oobCode) {
|
|
|
6725
6719
|
}
|
|
6726
6720
|
return [2 /*return*/, {
|
|
6727
6721
|
data: {
|
|
6728
|
-
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
6722
|
+
email: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
6729
6723
|
? response.newEmail
|
|
6730
6724
|
: response.email) || null,
|
|
6731
|
-
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */
|
|
6725
|
+
previousEmail: (response.requestType === "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */
|
|
6732
6726
|
? response.email
|
|
6733
6727
|
: response.newEmail) || null,
|
|
6734
6728
|
multiFactorInfo: multiFactorInfo
|
|
@@ -6794,7 +6788,7 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6794
6788
|
})];
|
|
6795
6789
|
case 1:
|
|
6796
6790
|
response = _a.sent();
|
|
6797
|
-
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* SIGN_IN */, response)];
|
|
6791
|
+
return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(authInternal, "signIn" /* OperationType.SIGN_IN */, response)];
|
|
6798
6792
|
case 2:
|
|
6799
6793
|
userCredential = _a.sent();
|
|
6800
6794
|
return [4 /*yield*/, authInternal._updateCurrentUser(userCredential.user)];
|
|
@@ -6887,10 +6881,10 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6887
6881
|
case 0:
|
|
6888
6882
|
authModular = getModularInstance(auth);
|
|
6889
6883
|
request = {
|
|
6890
|
-
requestType: "EMAIL_SIGNIN" /* EMAIL_SIGNIN */,
|
|
6884
|
+
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
6891
6885
|
email: email
|
|
6892
6886
|
};
|
|
6893
|
-
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
6887
|
+
_assert(actionCodeSettings.handleCodeInApp, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
6894
6888
|
if (actionCodeSettings) {
|
|
6895
6889
|
_setActionCodeSettingsOnRequest(authModular, request, actionCodeSettings);
|
|
6896
6890
|
}
|
|
@@ -6912,7 +6906,7 @@ function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
6912
6906
|
*/
|
|
6913
6907
|
function isSignInWithEmailLink(auth, emailLink) {
|
|
6914
6908
|
var actionCodeUrl = ActionCodeURL.parseLink(emailLink);
|
|
6915
|
-
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* EMAIL_SIGNIN */;
|
|
6909
|
+
return (actionCodeUrl === null || actionCodeUrl === void 0 ? void 0 : actionCodeUrl.operation) === "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */;
|
|
6916
6910
|
}
|
|
6917
6911
|
/**
|
|
6918
6912
|
* Asynchronously signs in using an email and sign-in email link.
|
|
@@ -6959,7 +6953,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6959
6953
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
6960
6954
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
6961
6955
|
// instance.
|
|
6962
|
-
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* TENANT_ID_MISMATCH */);
|
|
6956
|
+
_assert(credential._tenantId === (authModular.tenantId || null), authModular, "tenant-id-mismatch" /* AuthErrorCode.TENANT_ID_MISMATCH */);
|
|
6963
6957
|
return [2 /*return*/, signInWithCredential(authModular, credential)];
|
|
6964
6958
|
});
|
|
6965
6959
|
});
|
|
@@ -6984,7 +6978,7 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6984
6978
|
function createAuthUri(auth, request) {
|
|
6985
6979
|
return __awaiter(this, void 0, void 0, function () {
|
|
6986
6980
|
return __generator(this, function (_a) {
|
|
6987
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:createAuthUri" /* CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6981
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:createAuthUri" /* Endpoint.CREATE_AUTH_URI */, _addTidIfNecessary(auth, request))];
|
|
6988
6982
|
});
|
|
6989
6983
|
});
|
|
6990
6984
|
}
|
|
@@ -7079,7 +7073,7 @@ function sendEmailVerification(user, actionCodeSettings) {
|
|
|
7079
7073
|
case 1:
|
|
7080
7074
|
idToken = _a.sent();
|
|
7081
7075
|
request = {
|
|
7082
|
-
requestType: "VERIFY_EMAIL" /* VERIFY_EMAIL */,
|
|
7076
|
+
requestType: "VERIFY_EMAIL" /* ActionCodeOperation.VERIFY_EMAIL */,
|
|
7083
7077
|
idToken: idToken
|
|
7084
7078
|
};
|
|
7085
7079
|
if (actionCodeSettings) {
|
|
@@ -7143,7 +7137,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
7143
7137
|
case 1:
|
|
7144
7138
|
idToken = _a.sent();
|
|
7145
7139
|
request = {
|
|
7146
|
-
requestType: "VERIFY_AND_CHANGE_EMAIL" /* VERIFY_AND_CHANGE_EMAIL */,
|
|
7140
|
+
requestType: "VERIFY_AND_CHANGE_EMAIL" /* ActionCodeOperation.VERIFY_AND_CHANGE_EMAIL */,
|
|
7147
7141
|
idToken: idToken,
|
|
7148
7142
|
newEmail: newEmail
|
|
7149
7143
|
};
|
|
@@ -7187,7 +7181,7 @@ function verifyBeforeUpdateEmail(user, newEmail, actionCodeSettings) {
|
|
|
7187
7181
|
function updateProfile$1(auth, request) {
|
|
7188
7182
|
return __awaiter(this, void 0, void 0, function () {
|
|
7189
7183
|
return __generator(this, function (_a) {
|
|
7190
|
-
return [2 /*return*/, _performApiRequest(auth, "POST" /* POST */, "/v1/accounts:update" /* SET_ACCOUNT_INFO */, request)];
|
|
7184
|
+
return [2 /*return*/, _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v1/accounts:update" /* Endpoint.SET_ACCOUNT_INFO */, request)];
|
|
7191
7185
|
});
|
|
7192
7186
|
});
|
|
7193
7187
|
}
|
|
@@ -7243,7 +7237,7 @@ function updateProfile(user, _a) {
|
|
|
7243
7237
|
userInternal.photoURL = response.photoUrl || null;
|
|
7244
7238
|
passwordProvider = userInternal.providerData.find(function (_a) {
|
|
7245
7239
|
var providerId = _a.providerId;
|
|
7246
|
-
return providerId === "password" /* PASSWORD */;
|
|
7240
|
+
return providerId === "password" /* ProviderId.PASSWORD */;
|
|
7247
7241
|
});
|
|
7248
7242
|
if (passwordProvider) {
|
|
7249
7243
|
passwordProvider.displayName = userInternal.displayName;
|
|
@@ -7354,12 +7348,12 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
7354
7348
|
? JSON.parse(idTokenResponse.rawUserInfo)
|
|
7355
7349
|
: {};
|
|
7356
7350
|
var isNewUser = idTokenResponse.isNewUser ||
|
|
7357
|
-
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* SignupNewUser */;
|
|
7351
|
+
idTokenResponse.kind === "identitytoolkit#SignupNewUserResponse" /* IdTokenResponseKind.SignupNewUser */;
|
|
7358
7352
|
if (!providerId && (idTokenResponse === null || idTokenResponse === void 0 ? void 0 : idTokenResponse.idToken)) {
|
|
7359
7353
|
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'];
|
|
7360
7354
|
if (signInProvider) {
|
|
7361
|
-
var filteredProviderId = signInProvider !== "anonymous" /* ANONYMOUS */ &&
|
|
7362
|
-
signInProvider !== "custom" /* CUSTOM */
|
|
7355
|
+
var filteredProviderId = signInProvider !== "anonymous" /* ProviderId.ANONYMOUS */ &&
|
|
7356
|
+
signInProvider !== "custom" /* ProviderId.CUSTOM */
|
|
7363
7357
|
? signInProvider
|
|
7364
7358
|
: null;
|
|
7365
7359
|
// Uses generic class in accordance with the legacy SDK.
|
|
@@ -7370,16 +7364,16 @@ function _fromIdTokenResponse(idTokenResponse) {
|
|
|
7370
7364
|
return null;
|
|
7371
7365
|
}
|
|
7372
7366
|
switch (providerId) {
|
|
7373
|
-
case "facebook.com" /* FACEBOOK */:
|
|
7367
|
+
case "facebook.com" /* ProviderId.FACEBOOK */:
|
|
7374
7368
|
return new FacebookAdditionalUserInfo(isNewUser, profile);
|
|
7375
|
-
case "github.com" /* GITHUB */:
|
|
7369
|
+
case "github.com" /* ProviderId.GITHUB */:
|
|
7376
7370
|
return new GithubAdditionalUserInfo(isNewUser, profile);
|
|
7377
|
-
case "google.com" /* GOOGLE */:
|
|
7371
|
+
case "google.com" /* ProviderId.GOOGLE */:
|
|
7378
7372
|
return new GoogleAdditionalUserInfo(isNewUser, profile);
|
|
7379
|
-
case "twitter.com" /* TWITTER */:
|
|
7373
|
+
case "twitter.com" /* ProviderId.TWITTER */:
|
|
7380
7374
|
return new TwitterAdditionalUserInfo(isNewUser, profile, idTokenResponse.screenName || null);
|
|
7381
|
-
case "custom" /* CUSTOM */:
|
|
7382
|
-
case "anonymous" /* ANONYMOUS */:
|
|
7375
|
+
case "custom" /* ProviderId.CUSTOM */:
|
|
7376
|
+
case "anonymous" /* ProviderId.ANONYMOUS */:
|
|
7383
7377
|
return new GenericAdditionalUserInfo(isNewUser, null);
|
|
7384
7378
|
default:
|
|
7385
7379
|
return new GenericAdditionalUserInfo(isNewUser, providerId, profile);
|
|
@@ -7406,28 +7400,28 @@ var FederatedAdditionalUserInfoWithUsername = /** @class */ (function (_super) {
|
|
|
7406
7400
|
var FacebookAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7407
7401
|
__extends(FacebookAdditionalUserInfo, _super);
|
|
7408
7402
|
function FacebookAdditionalUserInfo(isNewUser, profile) {
|
|
7409
|
-
return _super.call(this, isNewUser, "facebook.com" /* FACEBOOK */, profile) || this;
|
|
7403
|
+
return _super.call(this, isNewUser, "facebook.com" /* ProviderId.FACEBOOK */, profile) || this;
|
|
7410
7404
|
}
|
|
7411
7405
|
return FacebookAdditionalUserInfo;
|
|
7412
7406
|
}(GenericAdditionalUserInfo));
|
|
7413
7407
|
var GithubAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7414
7408
|
__extends(GithubAdditionalUserInfo, _super);
|
|
7415
7409
|
function GithubAdditionalUserInfo(isNewUser, profile) {
|
|
7416
|
-
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;
|
|
7410
|
+
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;
|
|
7417
7411
|
}
|
|
7418
7412
|
return GithubAdditionalUserInfo;
|
|
7419
7413
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
7420
7414
|
var GoogleAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7421
7415
|
__extends(GoogleAdditionalUserInfo, _super);
|
|
7422
7416
|
function GoogleAdditionalUserInfo(isNewUser, profile) {
|
|
7423
|
-
return _super.call(this, isNewUser, "google.com" /* GOOGLE */, profile) || this;
|
|
7417
|
+
return _super.call(this, isNewUser, "google.com" /* ProviderId.GOOGLE */, profile) || this;
|
|
7424
7418
|
}
|
|
7425
7419
|
return GoogleAdditionalUserInfo;
|
|
7426
7420
|
}(GenericAdditionalUserInfo));
|
|
7427
7421
|
var TwitterAdditionalUserInfo = /** @class */ (function (_super) {
|
|
7428
7422
|
__extends(TwitterAdditionalUserInfo, _super);
|
|
7429
7423
|
function TwitterAdditionalUserInfo(isNewUser, profile, screenName) {
|
|
7430
|
-
return _super.call(this, isNewUser, "twitter.com" /* TWITTER */, profile, screenName) || this;
|
|
7424
|
+
return _super.call(this, isNewUser, "twitter.com" /* ProviderId.TWITTER */, profile, screenName) || this;
|
|
7431
7425
|
}
|
|
7432
7426
|
return TwitterAdditionalUserInfo;
|
|
7433
7427
|
}(FederatedAdditionalUserInfoWithUsername));
|
|
@@ -7610,14 +7604,14 @@ var MultiFactorSessionImpl = /** @class */ (function () {
|
|
|
7610
7604
|
this.auth = auth;
|
|
7611
7605
|
}
|
|
7612
7606
|
MultiFactorSessionImpl._fromIdtoken = function (idToken, auth) {
|
|
7613
|
-
return new MultiFactorSessionImpl("enroll" /* ENROLL */, idToken, auth);
|
|
7607
|
+
return new MultiFactorSessionImpl("enroll" /* MultiFactorSessionType.ENROLL */, idToken, auth);
|
|
7614
7608
|
};
|
|
7615
7609
|
MultiFactorSessionImpl._fromMfaPendingCredential = function (mfaPendingCredential) {
|
|
7616
|
-
return new MultiFactorSessionImpl("signin" /* SIGN_IN */, mfaPendingCredential);
|
|
7610
|
+
return new MultiFactorSessionImpl("signin" /* MultiFactorSessionType.SIGN_IN */, mfaPendingCredential);
|
|
7617
7611
|
};
|
|
7618
7612
|
MultiFactorSessionImpl.prototype.toJSON = function () {
|
|
7619
7613
|
var _a;
|
|
7620
|
-
var key = this.type === "enroll" /* ENROLL */
|
|
7614
|
+
var key = this.type === "enroll" /* MultiFactorSessionType.ENROLL */
|
|
7621
7615
|
? 'idToken'
|
|
7622
7616
|
: 'pendingCredential';
|
|
7623
7617
|
return {
|
|
@@ -7671,7 +7665,7 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7671
7665
|
var hints = (serverResponse.mfaInfo || []).map(function (enrollment) {
|
|
7672
7666
|
return MultiFactorInfoImpl._fromServerResponse(auth, enrollment);
|
|
7673
7667
|
});
|
|
7674
|
-
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7668
|
+
_assert(serverResponse.mfaPendingCredential, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7675
7669
|
var session = MultiFactorSessionImpl._fromMfaPendingCredential(serverResponse.mfaPendingCredential);
|
|
7676
7670
|
return new MultiFactorResolverImpl(session, hints, function (assertion) { return __awaiter(_this, void 0, void 0, function () {
|
|
7677
7671
|
var mfaResponse, idTokenResponse, _a, userCredential;
|
|
@@ -7686,8 +7680,8 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7686
7680
|
idTokenResponse = __assign(__assign({}, serverResponse), { idToken: mfaResponse.idToken, refreshToken: mfaResponse.refreshToken });
|
|
7687
7681
|
_a = error.operationType;
|
|
7688
7682
|
switch (_a) {
|
|
7689
|
-
case "signIn" /* SIGN_IN */: return [3 /*break*/, 2];
|
|
7690
|
-
case "reauthenticate" /* REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
7683
|
+
case "signIn" /* OperationType.SIGN_IN */: return [3 /*break*/, 2];
|
|
7684
|
+
case "reauthenticate" /* OperationType.REAUTHENTICATE */: return [3 /*break*/, 5];
|
|
7691
7685
|
}
|
|
7692
7686
|
return [3 /*break*/, 6];
|
|
7693
7687
|
case 2: return [4 /*yield*/, UserCredentialImpl._fromIdTokenResponse(auth, error.operationType, idTokenResponse)];
|
|
@@ -7698,10 +7692,10 @@ var MultiFactorResolverImpl = /** @class */ (function () {
|
|
|
7698
7692
|
_b.sent();
|
|
7699
7693
|
return [2 /*return*/, userCredential];
|
|
7700
7694
|
case 5:
|
|
7701
|
-
_assert(error.user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7695
|
+
_assert(error.user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7702
7696
|
return [2 /*return*/, UserCredentialImpl._forOperation(error.user, error.operationType, idTokenResponse)];
|
|
7703
7697
|
case 6:
|
|
7704
|
-
_fail(auth, "internal-error" /* INTERNAL_ERROR */);
|
|
7698
|
+
_fail(auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
7705
7699
|
_b.label = 7;
|
|
7706
7700
|
case 7: return [2 /*return*/];
|
|
7707
7701
|
}
|
|
@@ -7733,8 +7727,8 @@ function getMultiFactorResolver(auth, error) {
|
|
|
7733
7727
|
var _a;
|
|
7734
7728
|
var authModular = getModularInstance(auth);
|
|
7735
7729
|
var errorInternal = error;
|
|
7736
|
-
_assert(error.customData.operationType, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
7737
|
-
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* ARGUMENT_ERROR */);
|
|
7730
|
+
_assert(error.customData.operationType, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7731
|
+
_assert((_a = errorInternal.customData._serverResponse) === null || _a === void 0 ? void 0 : _a.mfaPendingCredential, authModular, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
7738
7732
|
return MultiFactorResolverImpl._fromError(authModular, errorInternal);
|
|
7739
7733
|
}
|
|
7740
7734
|
|
|
@@ -7755,13 +7749,13 @@ function getMultiFactorResolver(auth, error) {
|
|
|
7755
7749
|
* limitations under the License.
|
|
7756
7750
|
*/
|
|
7757
7751
|
function startEnrollPhoneMfa(auth, request) {
|
|
7758
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:start" /* START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
7752
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:start" /* Endpoint.START_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
7759
7753
|
}
|
|
7760
7754
|
function finalizeEnrollPhoneMfa(auth, request) {
|
|
7761
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:finalize" /* FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
7755
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:finalize" /* Endpoint.FINALIZE_MFA_ENROLLMENT */, _addTidIfNecessary(auth, request));
|
|
7762
7756
|
}
|
|
7763
7757
|
function withdrawMfa(auth, request) {
|
|
7764
|
-
return _performApiRequest(auth, "POST" /* POST */, "/v2/accounts/mfaEnrollment:withdraw" /* WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
7758
|
+
return _performApiRequest(auth, "POST" /* HttpMethod.POST */, "/v2/accounts/mfaEnrollment:withdraw" /* Endpoint.WITHDRAW_MFA */, _addTidIfNecessary(auth, request));
|
|
7765
7759
|
}
|
|
7766
7760
|
|
|
7767
7761
|
var MultiFactorUserImpl = /** @class */ (function () {
|
|
@@ -7822,22 +7816,21 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7822
7816
|
});
|
|
7823
7817
|
};
|
|
7824
7818
|
MultiFactorUserImpl.prototype.unenroll = function (infoOrUid) {
|
|
7825
|
-
var _a;
|
|
7826
7819
|
return __awaiter(this, void 0, void 0, function () {
|
|
7827
7820
|
var mfaEnrollmentId, idToken, idTokenResponse, e_1;
|
|
7828
|
-
return __generator(this, function (
|
|
7829
|
-
switch (
|
|
7821
|
+
return __generator(this, function (_a) {
|
|
7822
|
+
switch (_a.label) {
|
|
7830
7823
|
case 0:
|
|
7831
7824
|
mfaEnrollmentId = typeof infoOrUid === 'string' ? infoOrUid : infoOrUid.uid;
|
|
7832
7825
|
return [4 /*yield*/, this.user.getIdToken()];
|
|
7833
7826
|
case 1:
|
|
7834
|
-
idToken =
|
|
7827
|
+
idToken = _a.sent();
|
|
7835
7828
|
return [4 /*yield*/, _logoutIfInvalidated(this.user, withdrawMfa(this.user.auth, {
|
|
7836
7829
|
idToken: idToken,
|
|
7837
7830
|
mfaEnrollmentId: mfaEnrollmentId
|
|
7838
7831
|
}))];
|
|
7839
7832
|
case 2:
|
|
7840
|
-
idTokenResponse =
|
|
7833
|
+
idTokenResponse = _a.sent();
|
|
7841
7834
|
// Remove the second factor from the user's list.
|
|
7842
7835
|
this.enrolledFactors = this.enrolledFactors.filter(function (_a) {
|
|
7843
7836
|
var uid = _a.uid;
|
|
@@ -7853,17 +7846,17 @@ var MultiFactorUserImpl = /** @class */ (function () {
|
|
|
7853
7846
|
// the tokenResponse may be empty. If the tokens were not updated (and they
|
|
7854
7847
|
// are now invalid), reloading the user will discover this and invalidate
|
|
7855
7848
|
// the user's state accordingly.
|
|
7856
|
-
|
|
7857
|
-
|
|
7849
|
+
_a.sent();
|
|
7850
|
+
_a.label = 4;
|
|
7858
7851
|
case 4:
|
|
7859
|
-
|
|
7852
|
+
_a.trys.push([4, 6, , 7]);
|
|
7860
7853
|
return [4 /*yield*/, this.user.reload()];
|
|
7861
7854
|
case 5:
|
|
7862
|
-
|
|
7855
|
+
_a.sent();
|
|
7863
7856
|
return [3 /*break*/, 7];
|
|
7864
7857
|
case 6:
|
|
7865
|
-
e_1 =
|
|
7866
|
-
if ((
|
|
7858
|
+
e_1 = _a.sent();
|
|
7859
|
+
if ((e_1 === null || e_1 === void 0 ? void 0 : e_1.code) !== "auth/".concat("user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */)) {
|
|
7867
7860
|
throw e_1;
|
|
7868
7861
|
}
|
|
7869
7862
|
return [3 /*break*/, 7];
|
|
@@ -7894,7 +7887,7 @@ function multiFactor(user) {
|
|
|
7894
7887
|
}
|
|
7895
7888
|
|
|
7896
7889
|
var name = "@firebase/auth";
|
|
7897
|
-
var version = "0.
|
|
7890
|
+
var version = "0.21.0";
|
|
7898
7891
|
|
|
7899
7892
|
/**
|
|
7900
7893
|
* @license
|
|
@@ -7949,8 +7942,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7949
7942
|
return;
|
|
7950
7943
|
}
|
|
7951
7944
|
var unsubscribe = this.auth.onIdTokenChanged(function (user) {
|
|
7952
|
-
|
|
7953
|
-
listener(((_a = user) === null || _a === void 0 ? void 0 : _a.stsTokenManager.accessToken) || null);
|
|
7945
|
+
listener((user === null || user === void 0 ? void 0 : user.stsTokenManager.accessToken) || null);
|
|
7954
7946
|
});
|
|
7955
7947
|
this.internalListeners.set(listener, unsubscribe);
|
|
7956
7948
|
this.updateProactiveRefresh();
|
|
@@ -7966,7 +7958,7 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7966
7958
|
this.updateProactiveRefresh();
|
|
7967
7959
|
};
|
|
7968
7960
|
AuthInterop.prototype.assertAuthConfigured = function () {
|
|
7969
|
-
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7961
|
+
_assert(this.auth._initializationPromise, "dependent-sdk-initialized-before-auth" /* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */);
|
|
7970
7962
|
};
|
|
7971
7963
|
AuthInterop.prototype.updateProactiveRefresh = function () {
|
|
7972
7964
|
if (this.internalListeners.size > 0) {
|
|
@@ -7997,13 +7989,13 @@ var AuthInterop = /** @class */ (function () {
|
|
|
7997
7989
|
*/
|
|
7998
7990
|
function getVersionForPlatform(clientPlatform) {
|
|
7999
7991
|
switch (clientPlatform) {
|
|
8000
|
-
case "Node" /* NODE */:
|
|
7992
|
+
case "Node" /* ClientPlatform.NODE */:
|
|
8001
7993
|
return 'node';
|
|
8002
|
-
case "ReactNative" /* REACT_NATIVE */:
|
|
7994
|
+
case "ReactNative" /* ClientPlatform.REACT_NATIVE */:
|
|
8003
7995
|
return 'rn';
|
|
8004
|
-
case "Worker" /* WORKER */:
|
|
7996
|
+
case "Worker" /* ClientPlatform.WORKER */:
|
|
8005
7997
|
return 'webworker';
|
|
8006
|
-
case "Cordova" /* CORDOVA */:
|
|
7998
|
+
case "Cordova" /* ClientPlatform.CORDOVA */:
|
|
8007
7999
|
return 'cordova';
|
|
8008
8000
|
default:
|
|
8009
8001
|
return undefined;
|
|
@@ -8011,48 +8003,48 @@ function getVersionForPlatform(clientPlatform) {
|
|
|
8011
8003
|
}
|
|
8012
8004
|
/** @internal */
|
|
8013
8005
|
function registerAuth(clientPlatform) {
|
|
8014
|
-
_registerComponent(new Component("auth" /* AUTH */, function (container, _a) {
|
|
8006
|
+
_registerComponent(new Component("auth" /* _ComponentName.AUTH */, function (container, _a) {
|
|
8015
8007
|
var deps = _a.options;
|
|
8016
8008
|
var app = container.getProvider('app').getImmediate();
|
|
8017
8009
|
var heartbeatServiceProvider = container.getProvider('heartbeat');
|
|
8018
8010
|
var _b = app.options, apiKey = _b.apiKey, authDomain = _b.authDomain;
|
|
8019
8011
|
return (function (app, heartbeatServiceProvider) {
|
|
8020
|
-
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* INVALID_API_KEY */, { appName: app.name });
|
|
8012
|
+
_assert(apiKey && !apiKey.includes(':'), "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */, { appName: app.name });
|
|
8021
8013
|
// Auth domain is optional if IdP sign in isn't being used
|
|
8022
|
-
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* ARGUMENT_ERROR */, {
|
|
8014
|
+
_assert(!(authDomain === null || authDomain === void 0 ? void 0 : authDomain.includes(':')), "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */, {
|
|
8023
8015
|
appName: app.name
|
|
8024
8016
|
});
|
|
8025
8017
|
var config = {
|
|
8026
8018
|
apiKey: apiKey,
|
|
8027
8019
|
authDomain: authDomain,
|
|
8028
8020
|
clientPlatform: clientPlatform,
|
|
8029
|
-
apiHost: "identitytoolkit.googleapis.com" /* API_HOST */,
|
|
8030
|
-
tokenApiHost: "securetoken.googleapis.com" /* TOKEN_API_HOST */,
|
|
8031
|
-
apiScheme: "https" /* API_SCHEME */,
|
|
8021
|
+
apiHost: "identitytoolkit.googleapis.com" /* DefaultConfig.API_HOST */,
|
|
8022
|
+
tokenApiHost: "securetoken.googleapis.com" /* DefaultConfig.TOKEN_API_HOST */,
|
|
8023
|
+
apiScheme: "https" /* DefaultConfig.API_SCHEME */,
|
|
8032
8024
|
sdkClientVersion: _getClientVersion(clientPlatform)
|
|
8033
8025
|
};
|
|
8034
8026
|
var authInstance = new AuthImpl(app, heartbeatServiceProvider, config);
|
|
8035
8027
|
_initializeAuthInstance(authInstance, deps);
|
|
8036
8028
|
return authInstance;
|
|
8037
8029
|
})(app, heartbeatServiceProvider);
|
|
8038
|
-
}, "PUBLIC" /* PUBLIC */)
|
|
8030
|
+
}, "PUBLIC" /* ComponentType.PUBLIC */)
|
|
8039
8031
|
/**
|
|
8040
8032
|
* Auth can only be initialized by explicitly calling getAuth() or initializeAuth()
|
|
8041
8033
|
* For why we do this, See go/firebase-next-auth-init
|
|
8042
8034
|
*/
|
|
8043
|
-
.setInstantiationMode("EXPLICIT" /* EXPLICIT */)
|
|
8035
|
+
.setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */)
|
|
8044
8036
|
/**
|
|
8045
8037
|
* Because all firebase products that depend on auth depend on auth-internal directly,
|
|
8046
8038
|
* we need to initialize auth-internal after auth is initialized to make it available to other firebase products.
|
|
8047
8039
|
*/
|
|
8048
8040
|
.setInstanceCreatedCallback(function (container, _instanceIdentifier, _instance) {
|
|
8049
|
-
var authInternalProvider = container.getProvider("auth-internal" /* AUTH_INTERNAL */);
|
|
8041
|
+
var authInternalProvider = container.getProvider("auth-internal" /* _ComponentName.AUTH_INTERNAL */);
|
|
8050
8042
|
authInternalProvider.initialize();
|
|
8051
8043
|
}));
|
|
8052
|
-
_registerComponent(new Component("auth-internal" /* AUTH_INTERNAL */, function (container) {
|
|
8053
|
-
var auth = _castAuth(container.getProvider("auth" /* AUTH */).getImmediate());
|
|
8044
|
+
_registerComponent(new Component("auth-internal" /* _ComponentName.AUTH_INTERNAL */, function (container) {
|
|
8045
|
+
var auth = _castAuth(container.getProvider("auth" /* _ComponentName.AUTH */).getImmediate());
|
|
8054
8046
|
return (function (auth) { return new AuthInterop(auth); })(auth);
|
|
8055
|
-
}, "PRIVATE" /* PRIVATE */).setInstantiationMode("EXPLICIT" /* EXPLICIT */));
|
|
8047
|
+
}, "PRIVATE" /* ComponentType.PRIVATE */).setInstantiationMode("EXPLICIT" /* InstantiationMode.EXPLICIT */));
|
|
8056
8048
|
registerVersion(name, version, getVersionForPlatform(clientPlatform));
|
|
8057
8049
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
8058
8050
|
registerVersion(name, version, 'esm5');
|
|
@@ -8242,7 +8234,7 @@ var IE10_LOCAL_STORAGE_SYNC_DELAY = 10;
|
|
|
8242
8234
|
var BrowserLocalPersistence = /** @class */ (function (_super) {
|
|
8243
8235
|
__extends(BrowserLocalPersistence, _super);
|
|
8244
8236
|
function BrowserLocalPersistence() {
|
|
8245
|
-
var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* LOCAL */) || this;
|
|
8237
|
+
var _this = _super.call(this, function () { return window.localStorage; }, "LOCAL" /* PersistenceType.LOCAL */) || this;
|
|
8246
8238
|
_this.boundEventHandler = function (event, poll) { return _this.onStorageEvent(event, poll); };
|
|
8247
8239
|
_this.listeners = {};
|
|
8248
8240
|
_this.localCache = {};
|
|
@@ -8478,7 +8470,7 @@ var browserLocalPersistence = BrowserLocalPersistence;
|
|
|
8478
8470
|
var BrowserSessionPersistence = /** @class */ (function (_super) {
|
|
8479
8471
|
__extends(BrowserSessionPersistence, _super);
|
|
8480
8472
|
function BrowserSessionPersistence() {
|
|
8481
|
-
return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* SESSION */) || this;
|
|
8473
|
+
return _super.call(this, function () { return window.sessionStorage; }, "SESSION" /* PersistenceType.SESSION */) || this;
|
|
8482
8474
|
}
|
|
8483
8475
|
BrowserSessionPersistence.prototype._addListener = function (_key, _listener) {
|
|
8484
8476
|
// Listeners are not supported for session storage since it cannot be shared across windows
|
|
@@ -8524,7 +8516,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
8524
8516
|
if (resolverOverride) {
|
|
8525
8517
|
return _getInstance(resolverOverride);
|
|
8526
8518
|
}
|
|
8527
|
-
_assert(auth._popupRedirectResolver, auth, "argument-error" /* ARGUMENT_ERROR */);
|
|
8519
|
+
_assert(auth._popupRedirectResolver, auth, "argument-error" /* AuthErrorCode.ARGUMENT_ERROR */);
|
|
8528
8520
|
return auth._popupRedirectResolver;
|
|
8529
8521
|
}
|
|
8530
8522
|
|
|
@@ -8547,7 +8539,7 @@ function _withDefaultResolver(auth, resolverOverride) {
|
|
|
8547
8539
|
var IdpCredential = /** @class */ (function (_super) {
|
|
8548
8540
|
__extends(IdpCredential, _super);
|
|
8549
8541
|
function IdpCredential(params) {
|
|
8550
|
-
var _this = _super.call(this, "custom" /* CUSTOM */, "custom" /* CUSTOM */) || this;
|
|
8542
|
+
var _this = _super.call(this, "custom" /* ProviderId.CUSTOM */, "custom" /* ProviderId.CUSTOM */) || this;
|
|
8551
8543
|
_this.params = params;
|
|
8552
8544
|
return _this;
|
|
8553
8545
|
}
|
|
@@ -8582,7 +8574,7 @@ function _signIn(params) {
|
|
|
8582
8574
|
}
|
|
8583
8575
|
function _reauth(params) {
|
|
8584
8576
|
var auth = params.auth, user = params.user;
|
|
8585
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8577
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8586
8578
|
return _reauthenticate(user, new IdpCredential(params), params.bypassAuthState);
|
|
8587
8579
|
}
|
|
8588
8580
|
function _link(params) {
|
|
@@ -8590,7 +8582,7 @@ function _link(params) {
|
|
|
8590
8582
|
var auth, user;
|
|
8591
8583
|
return __generator(this, function (_a) {
|
|
8592
8584
|
auth = params.auth, user = params.user;
|
|
8593
|
-
_assert(user, auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8585
|
+
_assert(user, auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8594
8586
|
return [2 /*return*/, _link$1(user, new IdpCredential(params), params.bypassAuthState)];
|
|
8595
8587
|
});
|
|
8596
8588
|
});
|
|
@@ -8698,17 +8690,17 @@ var AbstractPopupRedirectOperation = /** @class */ (function () {
|
|
|
8698
8690
|
};
|
|
8699
8691
|
AbstractPopupRedirectOperation.prototype.getIdpTask = function (type) {
|
|
8700
8692
|
switch (type) {
|
|
8701
|
-
case "signInViaPopup" /* SIGN_IN_VIA_POPUP */:
|
|
8702
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
8693
|
+
case "signInViaPopup" /* AuthEventType.SIGN_IN_VIA_POPUP */:
|
|
8694
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
8703
8695
|
return _signIn;
|
|
8704
|
-
case "linkViaPopup" /* LINK_VIA_POPUP */:
|
|
8705
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
8696
|
+
case "linkViaPopup" /* AuthEventType.LINK_VIA_POPUP */:
|
|
8697
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
8706
8698
|
return _link;
|
|
8707
|
-
case "reauthViaPopup" /* REAUTH_VIA_POPUP */:
|
|
8708
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
8699
|
+
case "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */:
|
|
8700
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
8709
8701
|
return _reauth;
|
|
8710
8702
|
default:
|
|
8711
|
-
_fail(this.auth, "internal-error" /* INTERNAL_ERROR */);
|
|
8703
|
+
_fail(this.auth, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
8712
8704
|
}
|
|
8713
8705
|
};
|
|
8714
8706
|
AbstractPopupRedirectOperation.prototype.resolve = function (cred) {
|
|
@@ -8756,10 +8748,10 @@ var RedirectAction = /** @class */ (function (_super) {
|
|
|
8756
8748
|
function RedirectAction(auth, resolver, bypassAuthState) {
|
|
8757
8749
|
if (bypassAuthState === void 0) { bypassAuthState = false; }
|
|
8758
8750
|
var _this = _super.call(this, auth, [
|
|
8759
|
-
"signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */,
|
|
8760
|
-
"linkViaRedirect" /* LINK_VIA_REDIRECT */,
|
|
8761
|
-
"reauthViaRedirect" /* REAUTH_VIA_REDIRECT */,
|
|
8762
|
-
"unknown" /* UNKNOWN */
|
|
8751
|
+
"signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */,
|
|
8752
|
+
"linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */,
|
|
8753
|
+
"reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */,
|
|
8754
|
+
"unknown" /* AuthEventType.UNKNOWN */
|
|
8763
8755
|
], resolver, undefined, bypassAuthState) || this;
|
|
8764
8756
|
_this.eventId = null;
|
|
8765
8757
|
return _this;
|
|
@@ -8818,10 +8810,10 @@ var RedirectAction = /** @class */ (function (_super) {
|
|
|
8818
8810
|
return __generator(this, function (_a) {
|
|
8819
8811
|
switch (_a.label) {
|
|
8820
8812
|
case 0:
|
|
8821
|
-
if (event.type === "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */) {
|
|
8813
|
+
if (event.type === "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */) {
|
|
8822
8814
|
return [2 /*return*/, _super.prototype.onAuthEvent.call(this, event)];
|
|
8823
8815
|
}
|
|
8824
|
-
else if (event.type === "unknown" /* UNKNOWN */) {
|
|
8816
|
+
else if (event.type === "unknown" /* AuthEventType.UNKNOWN */) {
|
|
8825
8817
|
// This is a sentinel value indicating there's no pending redirect
|
|
8826
8818
|
this.resolve(null);
|
|
8827
8819
|
return [2 /*return*/];
|
|
@@ -8965,7 +8957,7 @@ function _signInWithRedirect(auth, provider, resolver) {
|
|
|
8965
8957
|
return [4 /*yield*/, _setPendingRedirectStatus(resolverInternal, authInternal)];
|
|
8966
8958
|
case 1:
|
|
8967
8959
|
_a.sent();
|
|
8968
|
-
return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */)];
|
|
8960
|
+
return [2 /*return*/, resolverInternal._openRedirect(authInternal, provider, "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */)];
|
|
8969
8961
|
}
|
|
8970
8962
|
});
|
|
8971
8963
|
});
|
|
@@ -9016,7 +9008,7 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
9016
9008
|
return [4 /*yield*/, prepareUserForRedirect(userInternal)];
|
|
9017
9009
|
case 2:
|
|
9018
9010
|
eventId = _a.sent();
|
|
9019
|
-
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */, eventId)];
|
|
9011
|
+
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */, eventId)];
|
|
9020
9012
|
}
|
|
9021
9013
|
});
|
|
9022
9014
|
});
|
|
@@ -9067,7 +9059,7 @@ function _linkWithRedirect(user, provider, resolver) {
|
|
|
9067
9059
|
return [4 /*yield*/, prepareUserForRedirect(userInternal)];
|
|
9068
9060
|
case 3:
|
|
9069
9061
|
eventId = _a.sent();
|
|
9070
|
-
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* LINK_VIA_REDIRECT */, eventId)];
|
|
9062
|
+
return [2 /*return*/, resolverInternal._openRedirect(userInternal.auth, provider, "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */, eventId)];
|
|
9071
9063
|
}
|
|
9072
9064
|
});
|
|
9073
9065
|
});
|
|
@@ -9155,7 +9147,7 @@ function prepareUserForRedirect(user) {
|
|
|
9155
9147
|
return __generator(this, function (_a) {
|
|
9156
9148
|
switch (_a.label) {
|
|
9157
9149
|
case 0:
|
|
9158
|
-
eventId = _generateEventId(user.uid
|
|
9150
|
+
eventId = _generateEventId("".concat(user.uid, ":::"));
|
|
9159
9151
|
user._redirectEventId = eventId;
|
|
9160
9152
|
return [4 /*yield*/, user.auth._setRedirectUser(user)];
|
|
9161
9153
|
case 1:
|
|
@@ -9198,8 +9190,8 @@ var WIDGET_PATH = '__/auth/handler';
|
|
|
9198
9190
|
*/
|
|
9199
9191
|
var EMULATOR_WIDGET_PATH = 'emulator/auth/handler';
|
|
9200
9192
|
function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additionalParams) {
|
|
9201
|
-
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* MISSING_AUTH_DOMAIN */);
|
|
9202
|
-
_assert(auth.config.apiKey, auth, "invalid-api-key" /* INVALID_API_KEY */);
|
|
9193
|
+
_assert(auth.config.authDomain, auth, "auth-domain-config-required" /* AuthErrorCode.MISSING_AUTH_DOMAIN */);
|
|
9194
|
+
_assert(auth.config.apiKey, auth, "invalid-api-key" /* AuthErrorCode.INVALID_API_KEY */);
|
|
9203
9195
|
var params = {
|
|
9204
9196
|
apiKey: auth.config.apiKey,
|
|
9205
9197
|
appName: auth.name,
|
|
@@ -9238,12 +9230,12 @@ function _getRedirectUrl(auth, provider, authType, redirectUrl, eventId, additio
|
|
|
9238
9230
|
delete paramsDict[key];
|
|
9239
9231
|
}
|
|
9240
9232
|
}
|
|
9241
|
-
return getHandlerBase(auth)
|
|
9233
|
+
return "".concat(getHandlerBase(auth), "?").concat(querystring(paramsDict).slice(1));
|
|
9242
9234
|
}
|
|
9243
9235
|
function getHandlerBase(_a) {
|
|
9244
9236
|
var config = _a.config;
|
|
9245
9237
|
if (!config.emulator) {
|
|
9246
|
-
return "https://"
|
|
9238
|
+
return "https://".concat(config.authDomain, "/").concat(WIDGET_PATH);
|
|
9247
9239
|
}
|
|
9248
9240
|
return _emulatorUrl(config, EMULATOR_WIDGET_PATH);
|
|
9249
9241
|
}
|
|
@@ -9288,7 +9280,7 @@ function _getProjectConfig(auth, request) {
|
|
|
9288
9280
|
if (request === void 0) { request = {}; }
|
|
9289
9281
|
return __awaiter(this, void 0, void 0, function () {
|
|
9290
9282
|
return __generator(this, function (_a) {
|
|
9291
|
-
return [2 /*return*/, _performApiRequest(auth, "GET" /* GET */, "/v1/projects" /* GET_PROJECT_CONFIG */, request)];
|
|
9283
|
+
return [2 /*return*/, _performApiRequest(auth, "GET" /* HttpMethod.GET */, "/v1/projects" /* Endpoint.GET_PROJECT_CONFIG */, request)];
|
|
9292
9284
|
});
|
|
9293
9285
|
});
|
|
9294
9286
|
}
|
|
@@ -9339,7 +9331,7 @@ function _generateHandlerUrl(auth, event, provider) {
|
|
|
9339
9331
|
additionalParams['apn'] = BuildInfo.packageName;
|
|
9340
9332
|
}
|
|
9341
9333
|
else {
|
|
9342
|
-
_fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
9334
|
+
_fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
9343
9335
|
}
|
|
9344
9336
|
// Add the display name if available
|
|
9345
9337
|
if (BuildInfo.displayName) {
|
|
@@ -9370,7 +9362,7 @@ function _validateOrigin(auth) {
|
|
|
9370
9362
|
request.androidPackageName = BuildInfo.packageName;
|
|
9371
9363
|
}
|
|
9372
9364
|
else {
|
|
9373
|
-
_fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
9365
|
+
_fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
9374
9366
|
}
|
|
9375
9367
|
// Will fail automatically if package name is not authorized
|
|
9376
9368
|
return [4 /*yield*/, _getProjectConfig(auth, request)];
|
|
@@ -9441,7 +9433,7 @@ function _waitForAppResume(auth, eventListener, iabRef) {
|
|
|
9441
9433
|
}
|
|
9442
9434
|
onCloseTimer = window.setTimeout(function () {
|
|
9443
9435
|
// Wait two seeconds after resume then reject.
|
|
9444
|
-
reject(_createError(auth, "redirect-cancelled-by-user" /* REDIRECT_CANCELLED_BY_USER */));
|
|
9436
|
+
reject(_createError(auth, "redirect-cancelled-by-user" /* AuthErrorCode.REDIRECT_CANCELLED_BY_USER */));
|
|
9445
9437
|
}, REDIRECT_TIMEOUT_MS);
|
|
9446
9438
|
}
|
|
9447
9439
|
function visibilityChanged() {
|
|
@@ -9491,22 +9483,22 @@ function _checkCordovaConfiguration(auth) {
|
|
|
9491
9483
|
// Note that cordova-universal-links-plugin has been abandoned.
|
|
9492
9484
|
// A fork with latest fixes is available at:
|
|
9493
9485
|
// https://www.npmjs.com/package/cordova-universal-links-plugin-fix
|
|
9494
|
-
_assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
9486
|
+
_assert(typeof ((_a = win === null || win === void 0 ? void 0 : win.universalLinks) === null || _a === void 0 ? void 0 : _a.subscribe) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
9495
9487
|
missingPlugin: 'cordova-universal-links-plugin-fix'
|
|
9496
9488
|
});
|
|
9497
9489
|
// https://www.npmjs.com/package/cordova-plugin-buildinfo
|
|
9498
|
-
_assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
9490
|
+
_assert(typeof ((_b = win === null || win === void 0 ? void 0 : win.BuildInfo) === null || _b === void 0 ? void 0 : _b.packageName) !== 'undefined', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
9499
9491
|
missingPlugin: 'cordova-plugin-buildInfo'
|
|
9500
9492
|
});
|
|
9501
9493
|
// https://github.com/google/cordova-plugin-browsertab
|
|
9502
|
-
_assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
9494
|
+
_assert(typeof ((_e = (_d = (_c = win === null || win === void 0 ? void 0 : win.cordova) === null || _c === void 0 ? void 0 : _c.plugins) === null || _d === void 0 ? void 0 : _d.browsertab) === null || _e === void 0 ? void 0 : _e.openUrl) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
9503
9495
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
9504
9496
|
});
|
|
9505
|
-
_assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
9497
|
+
_assert(typeof ((_h = (_g = (_f = win === null || win === void 0 ? void 0 : win.cordova) === null || _f === void 0 ? void 0 : _f.plugins) === null || _g === void 0 ? void 0 : _g.browsertab) === null || _h === void 0 ? void 0 : _h.isAvailable) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
9506
9498
|
missingPlugin: 'cordova-plugin-browsertab'
|
|
9507
9499
|
});
|
|
9508
9500
|
// https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/
|
|
9509
|
-
_assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* INVALID_CORDOVA_CONFIGURATION */, {
|
|
9501
|
+
_assert(typeof ((_k = (_j = win === null || win === void 0 ? void 0 : win.cordova) === null || _j === void 0 ? void 0 : _j.InAppBrowser) === null || _k === void 0 ? void 0 : _k.open) === 'function', auth, "invalid-cordova-configuration" /* AuthErrorCode.INVALID_CORDOVA_CONFIGURATION */, {
|
|
9510
9502
|
missingPlugin: 'cordova-plugin-inappbrowser'
|
|
9511
9503
|
});
|
|
9512
9504
|
}
|
|
@@ -9617,7 +9609,7 @@ var AuthEventManager = /** @class */ (function () {
|
|
|
9617
9609
|
var _a;
|
|
9618
9610
|
if (event.error && !isNullRedirectEvent(event)) {
|
|
9619
9611
|
var code = ((_a = event.error.code) === null || _a === void 0 ? void 0 : _a.split('auth/')[1]) ||
|
|
9620
|
-
"internal-error" /* INTERNAL_ERROR */;
|
|
9612
|
+
"internal-error" /* AuthErrorCode.INTERNAL_ERROR */;
|
|
9621
9613
|
consumer.onError(_createError(this.auth, code));
|
|
9622
9614
|
}
|
|
9623
9615
|
else {
|
|
@@ -9647,16 +9639,16 @@ function eventUid(e) {
|
|
|
9647
9639
|
}
|
|
9648
9640
|
function isNullRedirectEvent(_a) {
|
|
9649
9641
|
var type = _a.type, error = _a.error;
|
|
9650
|
-
return (type === "unknown" /* UNKNOWN */ &&
|
|
9651
|
-
(error === null || error === void 0 ? void 0 : error.code) === "auth/"
|
|
9642
|
+
return (type === "unknown" /* AuthEventType.UNKNOWN */ &&
|
|
9643
|
+
(error === null || error === void 0 ? void 0 : error.code) === "auth/".concat("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */));
|
|
9652
9644
|
}
|
|
9653
9645
|
function isRedirectEvent(event) {
|
|
9654
9646
|
switch (event.type) {
|
|
9655
|
-
case "signInViaRedirect" /* SIGN_IN_VIA_REDIRECT */:
|
|
9656
|
-
case "linkViaRedirect" /* LINK_VIA_REDIRECT */:
|
|
9657
|
-
case "reauthViaRedirect" /* REAUTH_VIA_REDIRECT */:
|
|
9647
|
+
case "signInViaRedirect" /* AuthEventType.SIGN_IN_VIA_REDIRECT */:
|
|
9648
|
+
case "linkViaRedirect" /* AuthEventType.LINK_VIA_REDIRECT */:
|
|
9649
|
+
case "reauthViaRedirect" /* AuthEventType.REAUTH_VIA_REDIRECT */:
|
|
9658
9650
|
return true;
|
|
9659
|
-
case "unknown" /* UNKNOWN */:
|
|
9651
|
+
case "unknown" /* AuthEventType.UNKNOWN */:
|
|
9660
9652
|
return isNullRedirectEvent(event);
|
|
9661
9653
|
default:
|
|
9662
9654
|
return false;
|
|
@@ -9735,7 +9727,7 @@ function _generateNewEvent(auth, type, eventId) {
|
|
|
9735
9727
|
sessionId: generateSessionId(),
|
|
9736
9728
|
postBody: null,
|
|
9737
9729
|
tenantId: auth.tenantId,
|
|
9738
|
-
error: _createError(auth, "no-auth-event" /* NO_AUTH_EVENT */)
|
|
9730
|
+
error: _createError(auth, "no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
|
|
9739
9731
|
};
|
|
9740
9732
|
}
|
|
9741
9733
|
function _savePartialEvent(auth, event) {
|
|
@@ -9816,7 +9808,7 @@ function storage() {
|
|
|
9816
9808
|
return _getInstance(browserLocalPersistence);
|
|
9817
9809
|
}
|
|
9818
9810
|
function persistenceKey(auth) {
|
|
9819
|
-
return _persistenceKeyName("authEvent" /* AUTH_EVENT */, auth.config.apiKey, auth.name);
|
|
9811
|
+
return _persistenceKeyName("authEvent" /* KeyName.AUTH_EVENT */, auth.config.apiKey, auth.name);
|
|
9820
9812
|
}
|
|
9821
9813
|
function parseJsonOrNull(json) {
|
|
9822
9814
|
try {
|
|
@@ -9897,7 +9889,7 @@ var CordovaPopupRedirectResolver = /** @class */ (function () {
|
|
|
9897
9889
|
});
|
|
9898
9890
|
};
|
|
9899
9891
|
CordovaPopupRedirectResolver.prototype._openPopup = function (auth) {
|
|
9900
|
-
_fail(auth, "operation-not-supported-in-this-environment" /* OPERATION_NOT_SUPPORTED */);
|
|
9892
|
+
_fail(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */);
|
|
9901
9893
|
};
|
|
9902
9894
|
CordovaPopupRedirectResolver.prototype._openRedirect = function (auth, provider, authType, eventId) {
|
|
9903
9895
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -9996,7 +9988,7 @@ var CordovaPopupRedirectResolver = /** @class */ (function () {
|
|
|
9996
9988
|
// https://github.com/EddyVerbruggen/Custom-URL-scheme
|
|
9997
9989
|
// Do not overwrite the existing developer's URL handler.
|
|
9998
9990
|
var existingHandleOpenURL = handleOpenURL;
|
|
9999
|
-
var packagePrefix = BuildInfo.packageName.toLowerCase()
|
|
9991
|
+
var packagePrefix = "".concat(BuildInfo.packageName.toLowerCase(), "://");
|
|
10000
9992
|
_cordovaWindow().handleOpenURL = function (url) { return __awaiter(_this, void 0, void 0, function () {
|
|
10001
9993
|
return __generator(this, function (_a) {
|
|
10002
9994
|
if (url.toLowerCase().startsWith(packagePrefix)) {
|
|
@@ -10029,15 +10021,15 @@ var CordovaPopupRedirectResolver = /** @class */ (function () {
|
|
|
10029
10021
|
var cordovaPopupRedirectResolver = CordovaPopupRedirectResolver;
|
|
10030
10022
|
function generateNoEvent() {
|
|
10031
10023
|
return {
|
|
10032
|
-
type: "unknown" /* UNKNOWN */,
|
|
10024
|
+
type: "unknown" /* AuthEventType.UNKNOWN */,
|
|
10033
10025
|
eventId: null,
|
|
10034
10026
|
sessionId: null,
|
|
10035
10027
|
urlResponse: null,
|
|
10036
10028
|
postBody: null,
|
|
10037
10029
|
tenantId: null,
|
|
10038
|
-
error: _createError("no-auth-event" /* NO_AUTH_EVENT */)
|
|
10030
|
+
error: _createError("no-auth-event" /* AuthErrorCode.NO_AUTH_EVENT */)
|
|
10039
10031
|
};
|
|
10040
10032
|
}
|
|
10041
10033
|
|
|
10042
10034
|
export { signInWithEmailLink as $, ActionCodeOperation as A, FacebookAuthProvider as B, GithubAuthProvider as C, OAuthProvider as D, EmailAuthCredential as E, FactorId as F, GoogleAuthProvider as G, SAMLAuthProvider as H, signInAnonymously as I, signInWithCredential as J, linkWithCredential as K, reauthenticateWithCredential as L, signInWithCustomToken as M, sendPasswordResetEmail as N, OperationType as O, ProviderId as P, confirmPasswordReset as Q, applyActionCode as R, SignInMethod as S, TwitterAuthProvider as T, checkActionCode as U, verifyPasswordResetCode as V, createUserWithEmailAndPassword as W, signInWithEmailAndPassword as X, sendSignInLinkToEmail as Y, isSignInWithEmailLink as Z, _signInWithRedirect as _, _reauthenticateWithRedirect as a, fetchSignInMethodsForEmail as a0, sendEmailVerification as a1, verifyBeforeUpdateEmail as a2, ActionCodeURL as a3, parseActionCodeURL as a4, updateProfile as a5, updateEmail as a6, updatePassword as a7, getIdToken as a8, getIdTokenResult as a9, _getCurrentUrl as aA, _emulatorUrl as aB, _isChromeIOS as aC, _isFirefox as aD, _isIOSStandalone as aE, _getRedirectUrl as aF, _setWindowLocation as aG, _isMobileBrowser as aH, _isSafari as aI, _isIOS as aJ, _getRedirectResult as aK, _overrideRedirectResult as aL, AuthEventManager as aM, debugFail as aN, finalizeEnrollPhoneMfa as aO, _persistenceKeyName as aP, UserImpl as aQ, _getInstance as aR, AuthImpl as aS, _getClientVersion as aT, FetchProvider as aU, SAMLAuthCredential as aV, signInWithRedirect as aW, linkWithRedirect as aX, reauthenticateWithRedirect as aY, unlink as aa, getAdditionalUserInfo as ab, reload as ac, getMultiFactorResolver as ad, multiFactor as ae, _performApiRequest as af, _addTidIfNecessary as ag, _createError as ah, _assert as ai, Delay as aj, _window as ak, _isHttpOrHttps as al, _isWorker as am, _castAuth as an, _assertLinkedStatus as ao, sendPhoneVerificationCode as ap, startEnrollPhoneMfa as aq, _link$1 as ar, debugAssert as as, _generateEventId as at, AbstractPopupRedirectOperation as au, _assertInstanceOf as av, _withDefaultResolver as aw, FederatedAuthProvider as ax, _fail as ay, _getProjectConfig as az, _linkWithRedirect as b, indexedDBLocalPersistence as c, cordovaPopupRedirectResolver as d, browserLocalPersistence as e, browserSessionPersistence as f, getRedirectResult as g, beforeAuthStateChanged as h, initializeAuth as i, onAuthStateChanged as j, updateCurrentUser as k, signOut as l, deleteUser as m, debugErrorMap as n, onIdTokenChanged as o, prodErrorMap as p, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as q, registerAuth as r, setPersistence as s, connectAuthEmulator as t, useDeviceLanguage as u, AuthCredential as v, OAuthCredential as w, PhoneAuthCredential as x, inMemoryPersistence as y, EmailAuthProvider as z };
|
|
10043
|
-
//# sourceMappingURL=popup_redirect-
|
|
10035
|
+
//# sourceMappingURL=popup_redirect-b7568081.js.map
|