@firebase/auth 1.6.2 → 1.7.0-canary.42fcdfe4c
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/dist/auth-public.d.ts +60 -10
- package/dist/auth.d.ts +61 -10
- package/dist/browser-cjs/{index-6a907fc6.js → index-fcf80d66.js} +202 -22
- package/dist/browser-cjs/index-fcf80d66.js.map +1 -0
- package/dist/browser-cjs/index.js +2 -2
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/browser-cjs/src/core/index.d.ts +9 -1
- package/dist/browser-cjs/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/browser-cjs/src/core/strategies/credential.d.ts +6 -0
- package/dist/browser-cjs/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/browser-cjs/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/browser-cjs/src/core/strategies/email_link.d.ts +4 -0
- package/dist/browser-cjs/src/core/user/account_info.d.ts +3 -0
- package/dist/browser-cjs/src/core/user/reload.d.ts +3 -1
- package/dist/browser-cjs/src/core/user/token_manager.d.ts +1 -0
- package/dist/browser-cjs/src/core/user/user_impl.d.ts +7 -1
- package/dist/browser-cjs/src/core/util/assert.d.ts +1 -0
- package/dist/browser-cjs/src/model/public_types.d.ts +7 -0
- package/dist/browser-cjs/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/browser-cjs/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/browser-cjs/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/browser-cjs/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/browser-cjs/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +45 -17
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-58faecee.js → popup_redirect-65e04583.js} +197 -17
- package/dist/cordova/popup_redirect-65e04583.js.map +1 -0
- package/dist/cordova/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/cordova/src/core/index.d.ts +9 -1
- package/dist/cordova/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/cordova/src/core/strategies/credential.d.ts +6 -0
- package/dist/cordova/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/cordova/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/cordova/src/core/strategies/email_link.d.ts +4 -0
- package/dist/cordova/src/core/user/account_info.d.ts +3 -0
- package/dist/cordova/src/core/user/reload.d.ts +3 -1
- package/dist/cordova/src/core/user/token_manager.d.ts +1 -0
- package/dist/cordova/src/core/user/user_impl.d.ts +7 -1
- package/dist/cordova/src/core/util/assert.d.ts +1 -0
- package/dist/cordova/src/model/public_types.d.ts +7 -0
- package/dist/cordova/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/cordova/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/cordova/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/cordova/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/cordova/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/esm2017/{index-e939beb5.js → index-3ad9a9b9.js} +202 -22
- package/dist/esm2017/index-3ad9a9b9.js.map +1 -0
- package/dist/esm2017/index.js +2 -2
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/esm2017/src/core/index.d.ts +9 -1
- package/dist/esm2017/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/esm2017/src/core/strategies/credential.d.ts +6 -0
- package/dist/esm2017/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/esm2017/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/esm2017/src/core/strategies/email_link.d.ts +4 -0
- package/dist/esm2017/src/core/user/account_info.d.ts +3 -0
- package/dist/esm2017/src/core/user/reload.d.ts +3 -1
- package/dist/esm2017/src/core/user/token_manager.d.ts +1 -0
- package/dist/esm2017/src/core/user/user_impl.d.ts +7 -1
- package/dist/esm2017/src/core/util/assert.d.ts +1 -0
- package/dist/esm2017/src/model/public_types.d.ts +7 -0
- package/dist/esm2017/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/esm2017/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/esm2017/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/esm2017/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/esm2017/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/esm5/{index-3bd54529.js → index-dcfb76ea.js} +238 -30
- package/dist/esm5/index-dcfb76ea.js.map +1 -0
- package/dist/esm5/index.js +2 -2
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/esm5/src/core/index.d.ts +9 -1
- package/dist/esm5/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/esm5/src/core/strategies/credential.d.ts +6 -0
- package/dist/esm5/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/esm5/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/esm5/src/core/strategies/email_link.d.ts +4 -0
- package/dist/esm5/src/core/user/account_info.d.ts +3 -0
- package/dist/esm5/src/core/user/reload.d.ts +3 -1
- package/dist/esm5/src/core/user/token_manager.d.ts +1 -0
- package/dist/esm5/src/core/user/user_impl.d.ts +7 -1
- package/dist/esm5/src/core/util/assert.d.ts +1 -0
- package/dist/esm5/src/model/public_types.d.ts +7 -0
- package/dist/esm5/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/esm5/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/esm5/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/esm5/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/esm5/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/index.webworker.esm5.js +178 -11
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +2 -2
- package/dist/node/internal.js +4 -1
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/node/src/core/index.d.ts +9 -1
- package/dist/node/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/node/src/core/strategies/credential.d.ts +6 -0
- package/dist/node/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/node/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/node/src/core/strategies/email_link.d.ts +4 -0
- package/dist/node/src/core/user/account_info.d.ts +3 -0
- package/dist/node/src/core/user/reload.d.ts +3 -1
- package/dist/node/src/core/user/token_manager.d.ts +1 -0
- package/dist/node/src/core/user/user_impl.d.ts +7 -1
- package/dist/node/src/core/util/assert.d.ts +1 -0
- package/dist/node/src/model/public_types.d.ts +7 -0
- package/dist/node/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/node/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/node/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/node/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/node/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/node/{totp-7d693c11.js → totp-fbe187a4.js} +180 -12
- package/dist/node/totp-fbe187a4.js.map +1 -0
- package/dist/node-esm/index.js +2 -2
- package/dist/node-esm/internal.js +6 -3
- package/dist/node-esm/internal.js.map +1 -1
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/node-esm/src/core/index.d.ts +9 -1
- package/dist/node-esm/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/node-esm/src/core/strategies/credential.d.ts +6 -0
- package/dist/node-esm/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/node-esm/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/node-esm/src/core/strategies/email_link.d.ts +4 -0
- package/dist/node-esm/src/core/user/account_info.d.ts +3 -0
- package/dist/node-esm/src/core/user/reload.d.ts +3 -1
- package/dist/node-esm/src/core/user/token_manager.d.ts +1 -0
- package/dist/node-esm/src/core/user/user_impl.d.ts +7 -1
- package/dist/node-esm/src/core/util/assert.d.ts +1 -0
- package/dist/node-esm/src/model/public_types.d.ts +7 -0
- package/dist/node-esm/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/node-esm/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/node-esm/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/node-esm/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/node-esm/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/node-esm/{totp-56a8eeec.js → totp-4d1c9ab1.js} +148 -7
- package/dist/node-esm/totp-4d1c9ab1.js.map +1 -0
- package/dist/rn/{index-8ee80bdc.js → index-bbdaa838.js} +199 -16
- package/dist/rn/index-bbdaa838.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +41 -15
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/rn/src/core/index.d.ts +9 -1
- package/dist/rn/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/rn/src/core/strategies/credential.d.ts +6 -0
- package/dist/rn/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/rn/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/rn/src/core/strategies/email_link.d.ts +4 -0
- package/dist/rn/src/core/user/account_info.d.ts +3 -0
- package/dist/rn/src/core/user/reload.d.ts +3 -1
- package/dist/rn/src/core/user/token_manager.d.ts +1 -0
- package/dist/rn/src/core/user/user_impl.d.ts +7 -1
- package/dist/rn/src/core/util/assert.d.ts +1 -0
- package/dist/rn/src/model/public_types.d.ts +7 -0
- package/dist/rn/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/rn/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/rn/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/rn/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/rn/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/src/core/index.d.ts +9 -1
- package/dist/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/src/core/strategies/credential.d.ts +6 -0
- package/dist/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/src/core/strategies/email_link.d.ts +4 -0
- package/dist/src/core/user/account_info.d.ts +3 -0
- package/dist/src/core/user/reload.d.ts +3 -1
- package/dist/src/core/user/token_manager.d.ts +1 -0
- package/dist/src/core/user/user_impl.d.ts +7 -1
- package/dist/src/core/util/assert.d.ts +1 -0
- package/dist/src/model/public_types.d.ts +7 -0
- package/dist/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/web-extension-cjs/index.js +1 -1
- package/dist/web-extension-cjs/internal.js +57 -18
- package/dist/web-extension-cjs/internal.js.map +1 -1
- package/dist/web-extension-cjs/{register-9438f377.js → register-4ce22251.js} +148 -6
- package/dist/web-extension-cjs/register-4ce22251.js.map +1 -0
- package/dist/web-extension-cjs/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/web-extension-cjs/src/core/index.d.ts +9 -1
- package/dist/web-extension-cjs/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/web-extension-cjs/src/core/strategies/credential.d.ts +6 -0
- package/dist/web-extension-cjs/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/web-extension-cjs/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/web-extension-cjs/src/core/strategies/email_link.d.ts +4 -0
- package/dist/web-extension-cjs/src/core/user/account_info.d.ts +3 -0
- package/dist/web-extension-cjs/src/core/user/reload.d.ts +3 -1
- package/dist/web-extension-cjs/src/core/user/token_manager.d.ts +1 -0
- package/dist/web-extension-cjs/src/core/user/user_impl.d.ts +7 -1
- package/dist/web-extension-cjs/src/core/util/assert.d.ts +1 -0
- package/dist/web-extension-cjs/src/model/public_types.d.ts +7 -0
- package/dist/web-extension-cjs/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/web-extension-cjs/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/web-extension-cjs/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/web-extension-cjs/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/web-extension-cjs/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/dist/web-extension-esm2017/index.js +2 -2
- package/dist/web-extension-esm2017/internal.js +58 -19
- package/dist/web-extension-esm2017/internal.js.map +1 -1
- package/dist/web-extension-esm2017/{register-7b89e556.js → register-3473374b.js} +148 -7
- package/dist/web-extension-esm2017/register-3473374b.js.map +1 -0
- package/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts +1 -0
- package/dist/web-extension-esm2017/src/core/index.d.ts +9 -1
- package/dist/web-extension-esm2017/src/core/strategies/anonymous.d.ts +3 -0
- package/dist/web-extension-esm2017/src/core/strategies/credential.d.ts +6 -0
- package/dist/web-extension-esm2017/src/core/strategies/custom_token.d.ts +3 -0
- package/dist/web-extension-esm2017/src/core/strategies/email_and_password.d.ts +7 -0
- package/dist/web-extension-esm2017/src/core/strategies/email_link.d.ts +4 -0
- package/dist/web-extension-esm2017/src/core/user/account_info.d.ts +3 -0
- package/dist/web-extension-esm2017/src/core/user/reload.d.ts +3 -1
- package/dist/web-extension-esm2017/src/core/user/token_manager.d.ts +1 -0
- package/dist/web-extension-esm2017/src/core/user/user_impl.d.ts +7 -1
- package/dist/web-extension-esm2017/src/core/util/assert.d.ts +1 -0
- package/dist/web-extension-esm2017/src/model/public_types.d.ts +7 -0
- package/dist/web-extension-esm2017/src/platform_browser/strategies/phone.d.ts +6 -3
- package/dist/web-extension-esm2017/src/platform_browser/strategies/popup.d.ts +4 -2
- package/dist/web-extension-esm2017/src/platform_browser/strategies/redirect.d.ts +8 -4
- package/dist/web-extension-esm2017/test/helpers/integration/helpers.d.ts +2 -0
- package/dist/web-extension-esm2017/test/integration/flows/firebaseserverapp.test.d.ts +17 -0
- package/package.json +7 -7
- package/dist/browser-cjs/index-6a907fc6.js.map +0 -1
- package/dist/cordova/popup_redirect-58faecee.js.map +0 -1
- package/dist/esm2017/index-e939beb5.js.map +0 -1
- package/dist/esm5/index-3bd54529.js.map +0 -1
- package/dist/node/totp-7d693c11.js.map +0 -1
- package/dist/node-esm/totp-56a8eeec.js.map +0 -1
- package/dist/rn/index-8ee80bdc.js.map +0 -1
- package/dist/web-extension-cjs/register-9438f377.js.map +0 -1
- package/dist/web-extension-esm2017/register-7b89e556.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
|
-
var util = require('@firebase/util');
|
|
5
4
|
var app = require('@firebase/app');
|
|
5
|
+
var util = require('@firebase/util');
|
|
6
6
|
var component = require('@firebase/component');
|
|
7
7
|
var undici = require('undici');
|
|
8
8
|
var logger = require('@firebase/logger');
|
|
@@ -502,6 +502,9 @@ function _errorWithCustomMessage(auth, code, message) {
|
|
|
502
502
|
appName: auth.name
|
|
503
503
|
});
|
|
504
504
|
}
|
|
505
|
+
function _serverAppCurrentUserOperationNotSupportedError(auth) {
|
|
506
|
+
return _errorWithCustomMessage(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */, 'Operations that alter the current user are not supported in conjunction with FirebaseServerApp');
|
|
507
|
+
}
|
|
505
508
|
function createErrorInternal(authOrCode) {
|
|
506
509
|
var _a;
|
|
507
510
|
var rest = [];
|
|
@@ -1765,16 +1768,21 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1765
1768
|
: _tokenExpiresIn(response.idToken);
|
|
1766
1769
|
this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
|
|
1767
1770
|
};
|
|
1771
|
+
StsTokenManager.prototype.updateFromIdToken = function (idToken) {
|
|
1772
|
+
_assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1773
|
+
var expiresIn = _tokenExpiresIn(idToken);
|
|
1774
|
+
this.updateTokensAndExpiration(idToken, null, expiresIn);
|
|
1775
|
+
};
|
|
1768
1776
|
StsTokenManager.prototype.getToken = function (auth, forceRefresh) {
|
|
1769
1777
|
if (forceRefresh === void 0) { forceRefresh = false; }
|
|
1770
1778
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1771
1779
|
return tslib.__generator(this, function (_a) {
|
|
1772
1780
|
switch (_a.label) {
|
|
1773
1781
|
case 0:
|
|
1774
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1775
1782
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1776
1783
|
return [2 /*return*/, this.accessToken];
|
|
1777
1784
|
}
|
|
1785
|
+
_assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1778
1786
|
if (!this.refreshToken) return [3 /*break*/, 2];
|
|
1779
1787
|
return [4 /*yield*/, this.refresh(auth, this.refreshToken)];
|
|
1780
1788
|
case 1:
|
|
@@ -1998,7 +2006,11 @@ var UserImpl = /** @class */ (function () {
|
|
|
1998
2006
|
var idToken;
|
|
1999
2007
|
return tslib.__generator(this, function (_a) {
|
|
2000
2008
|
switch (_a.label) {
|
|
2001
|
-
case 0:
|
|
2009
|
+
case 0:
|
|
2010
|
+
if (app._isFirebaseServerApp(this.auth.app)) {
|
|
2011
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth))];
|
|
2012
|
+
}
|
|
2013
|
+
return [4 /*yield*/, this.getIdToken()];
|
|
2002
2014
|
case 1:
|
|
2003
2015
|
idToken = _a.sent();
|
|
2004
2016
|
return [4 /*yield*/, _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken: idToken }))];
|
|
@@ -2103,6 +2115,47 @@ var UserImpl = /** @class */ (function () {
|
|
|
2103
2115
|
});
|
|
2104
2116
|
});
|
|
2105
2117
|
};
|
|
2118
|
+
/**
|
|
2119
|
+
* Initialize a User from an idToken server response
|
|
2120
|
+
* @param auth
|
|
2121
|
+
* @param idTokenResponse
|
|
2122
|
+
*/
|
|
2123
|
+
UserImpl._fromGetAccountInfoResponse = function (auth, response, idToken) {
|
|
2124
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2125
|
+
var coreAccount, providerData, isAnonymous, stsTokenManager, user, updates;
|
|
2126
|
+
return tslib.__generator(this, function (_a) {
|
|
2127
|
+
coreAccount = response.users[0];
|
|
2128
|
+
_assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2129
|
+
providerData = coreAccount.providerUserInfo !== undefined
|
|
2130
|
+
? extractProviderData(coreAccount.providerUserInfo)
|
|
2131
|
+
: [];
|
|
2132
|
+
isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);
|
|
2133
|
+
stsTokenManager = new StsTokenManager();
|
|
2134
|
+
stsTokenManager.updateFromIdToken(idToken);
|
|
2135
|
+
user = new UserImpl({
|
|
2136
|
+
uid: coreAccount.localId,
|
|
2137
|
+
auth: auth,
|
|
2138
|
+
stsTokenManager: stsTokenManager,
|
|
2139
|
+
isAnonymous: isAnonymous
|
|
2140
|
+
});
|
|
2141
|
+
updates = {
|
|
2142
|
+
uid: coreAccount.localId,
|
|
2143
|
+
displayName: coreAccount.displayName || null,
|
|
2144
|
+
photoURL: coreAccount.photoUrl || null,
|
|
2145
|
+
email: coreAccount.email || null,
|
|
2146
|
+
emailVerified: coreAccount.emailVerified || false,
|
|
2147
|
+
phoneNumber: coreAccount.phoneNumber || null,
|
|
2148
|
+
tenantId: coreAccount.tenantId || null,
|
|
2149
|
+
providerData: providerData,
|
|
2150
|
+
metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),
|
|
2151
|
+
isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&
|
|
2152
|
+
!(providerData === null || providerData === void 0 ? void 0 : providerData.length)
|
|
2153
|
+
};
|
|
2154
|
+
Object.assign(user, updates);
|
|
2155
|
+
return [2 /*return*/, user];
|
|
2156
|
+
});
|
|
2157
|
+
});
|
|
2158
|
+
};
|
|
2106
2159
|
return UserImpl;
|
|
2107
2160
|
}());
|
|
2108
2161
|
|
|
@@ -2999,13 +3052,59 @@ var AuthImpl = /** @class */ (function () {
|
|
|
2999
3052
|
});
|
|
3000
3053
|
});
|
|
3001
3054
|
};
|
|
3055
|
+
AuthImpl.prototype.initializeCurrentUserFromIdToken = function (idToken) {
|
|
3056
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3057
|
+
var response, user, err_1;
|
|
3058
|
+
return tslib.__generator(this, function (_a) {
|
|
3059
|
+
switch (_a.label) {
|
|
3060
|
+
case 0:
|
|
3061
|
+
_a.trys.push([0, 4, , 6]);
|
|
3062
|
+
return [4 /*yield*/, getAccountInfo(this, { idToken: idToken })];
|
|
3063
|
+
case 1:
|
|
3064
|
+
response = _a.sent();
|
|
3065
|
+
return [4 /*yield*/, UserImpl._fromGetAccountInfoResponse(this, response, idToken)];
|
|
3066
|
+
case 2:
|
|
3067
|
+
user = _a.sent();
|
|
3068
|
+
return [4 /*yield*/, this.directlySetCurrentUser(user)];
|
|
3069
|
+
case 3:
|
|
3070
|
+
_a.sent();
|
|
3071
|
+
return [3 /*break*/, 6];
|
|
3072
|
+
case 4:
|
|
3073
|
+
err_1 = _a.sent();
|
|
3074
|
+
console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err_1);
|
|
3075
|
+
return [4 /*yield*/, this.directlySetCurrentUser(null)];
|
|
3076
|
+
case 5:
|
|
3077
|
+
_a.sent();
|
|
3078
|
+
return [3 /*break*/, 6];
|
|
3079
|
+
case 6: return [2 /*return*/];
|
|
3080
|
+
}
|
|
3081
|
+
});
|
|
3082
|
+
});
|
|
3083
|
+
};
|
|
3002
3084
|
AuthImpl.prototype.initializeCurrentUser = function (popupRedirectResolver) {
|
|
3003
3085
|
var _a;
|
|
3004
3086
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3005
|
-
var previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
|
|
3087
|
+
var idToken_1, previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
|
|
3088
|
+
var _this = this;
|
|
3006
3089
|
return tslib.__generator(this, function (_b) {
|
|
3007
3090
|
switch (_b.label) {
|
|
3008
|
-
case 0:
|
|
3091
|
+
case 0:
|
|
3092
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
3093
|
+
idToken_1 = this.app.settings.authIdToken;
|
|
3094
|
+
if (idToken_1) {
|
|
3095
|
+
// Start the auth operation in the next tick to allow a moment for the customer's app to
|
|
3096
|
+
// attach an emulator, if desired.
|
|
3097
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
3098
|
+
setTimeout(function () {
|
|
3099
|
+
return _this.initializeCurrentUserFromIdToken(idToken_1).then(resolve, resolve);
|
|
3100
|
+
});
|
|
3101
|
+
})];
|
|
3102
|
+
}
|
|
3103
|
+
else {
|
|
3104
|
+
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
return [4 /*yield*/, this.assertedPersistence.getCurrentUser()];
|
|
3009
3108
|
case 1:
|
|
3010
3109
|
previouslyStoredUser = (_b.sent());
|
|
3011
3110
|
futureCurrentUser = previouslyStoredUser;
|
|
@@ -3147,6 +3246,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3147
3246
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3148
3247
|
var user;
|
|
3149
3248
|
return tslib.__generator(this, function (_a) {
|
|
3249
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
3250
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
|
|
3251
|
+
}
|
|
3150
3252
|
user = userExtern
|
|
3151
3253
|
? util.getModularInstance(userExtern)
|
|
3152
3254
|
: null;
|
|
@@ -3194,9 +3296,12 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3194
3296
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3195
3297
|
return tslib.__generator(this, function (_a) {
|
|
3196
3298
|
switch (_a.label) {
|
|
3197
|
-
case 0:
|
|
3198
|
-
|
|
3199
|
-
|
|
3299
|
+
case 0:
|
|
3300
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
3301
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
|
|
3302
|
+
}
|
|
3303
|
+
// Run first, to block _setRedirectUser() if any callbacks fail.
|
|
3304
|
+
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(null)];
|
|
3200
3305
|
case 1:
|
|
3201
3306
|
// Run first, to block _setRedirectUser() if any callbacks fail.
|
|
3202
3307
|
_a.sent();
|
|
@@ -3215,6 +3320,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3215
3320
|
};
|
|
3216
3321
|
AuthImpl.prototype.setPersistence = function (persistence) {
|
|
3217
3322
|
var _this = this;
|
|
3323
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
3324
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
|
|
3325
|
+
}
|
|
3218
3326
|
return this.queue(function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
3219
3327
|
return tslib.__generator(this, function (_a) {
|
|
3220
3328
|
switch (_a.label) {
|
|
@@ -5983,6 +6091,9 @@ function providerIdForResponse(response) {
|
|
|
5983
6091
|
* If there is already an anonymous user signed in, that user will be returned; otherwise, a
|
|
5984
6092
|
* new anonymous user identity will be created and returned.
|
|
5985
6093
|
*
|
|
6094
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6095
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6096
|
+
*
|
|
5986
6097
|
* @param auth - The {@link Auth} instance.
|
|
5987
6098
|
*
|
|
5988
6099
|
* @public
|
|
@@ -5994,6 +6105,9 @@ function signInAnonymously(auth) {
|
|
|
5994
6105
|
return tslib.__generator(this, function (_b) {
|
|
5995
6106
|
switch (_b.label) {
|
|
5996
6107
|
case 0:
|
|
6108
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6109
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6110
|
+
}
|
|
5997
6111
|
authInternal = _castAuth(auth);
|
|
5998
6112
|
return [4 /*yield*/, authInternal._initializationPromise];
|
|
5999
6113
|
case 1:
|
|
@@ -6225,6 +6339,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
|
|
|
6225
6339
|
switch (_a.label) {
|
|
6226
6340
|
case 0:
|
|
6227
6341
|
auth = user.auth;
|
|
6342
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6343
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6344
|
+
}
|
|
6228
6345
|
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
6229
6346
|
_a.label = 1;
|
|
6230
6347
|
case 1:
|
|
@@ -6274,6 +6391,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6274
6391
|
return tslib.__generator(this, function (_a) {
|
|
6275
6392
|
switch (_a.label) {
|
|
6276
6393
|
case 0:
|
|
6394
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6395
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6396
|
+
}
|
|
6277
6397
|
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
6278
6398
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
6279
6399
|
case 1:
|
|
@@ -6297,6 +6417,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6297
6417
|
* @remarks
|
|
6298
6418
|
* An {@link AuthProvider} can be used to generate the credential.
|
|
6299
6419
|
*
|
|
6420
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6421
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6422
|
+
*
|
|
6300
6423
|
* @param auth - The {@link Auth} instance.
|
|
6301
6424
|
* @param credential - The auth credential.
|
|
6302
6425
|
*
|
|
@@ -6343,6 +6466,9 @@ function linkWithCredential(user, credential) {
|
|
|
6343
6466
|
* attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
|
|
6344
6467
|
* or a `TOKEN_EXPIRED` error.
|
|
6345
6468
|
*
|
|
6469
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
6470
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
6471
|
+
*
|
|
6346
6472
|
* @param user - The user.
|
|
6347
6473
|
* @param credential - The auth credential.
|
|
6348
6474
|
*
|
|
@@ -6407,6 +6533,9 @@ function signInWithCustomToken$1(auth, request) {
|
|
|
6407
6533
|
*
|
|
6408
6534
|
* Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
|
|
6409
6535
|
*
|
|
6536
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6537
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6538
|
+
*
|
|
6410
6539
|
* @param auth - The {@link Auth} instance.
|
|
6411
6540
|
* @param customToken - The custom token to sign in with.
|
|
6412
6541
|
*
|
|
@@ -6418,6 +6547,9 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
6418
6547
|
return tslib.__generator(this, function (_a) {
|
|
6419
6548
|
switch (_a.label) {
|
|
6420
6549
|
case 0:
|
|
6550
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6551
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6552
|
+
}
|
|
6421
6553
|
authInternal = _castAuth(auth);
|
|
6422
6554
|
return [4 /*yield*/, signInWithCustomToken$1(authInternal, {
|
|
6423
6555
|
token: customToken,
|
|
@@ -6774,6 +6906,9 @@ function verifyPasswordResetCode(auth, code) {
|
|
|
6774
6906
|
*
|
|
6775
6907
|
* User account creation can fail if the account already exists or the password is invalid.
|
|
6776
6908
|
*
|
|
6909
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
6910
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6911
|
+
*
|
|
6777
6912
|
* Note: The email address acts as a unique identifier for the user and enables an email-based
|
|
6778
6913
|
* password reset. This function will create a new user account and set the initial user password.
|
|
6779
6914
|
*
|
|
@@ -6789,6 +6924,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6789
6924
|
return tslib.__generator(this, function (_a) {
|
|
6790
6925
|
switch (_a.label) {
|
|
6791
6926
|
case 0:
|
|
6927
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6928
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6929
|
+
}
|
|
6792
6930
|
authInternal = _castAuth(auth);
|
|
6793
6931
|
request = {
|
|
6794
6932
|
returnSecureToken: true,
|
|
@@ -6824,10 +6962,14 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6824
6962
|
* When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
|
|
6825
6963
|
* this method fails with "auth/invalid-credential" in case of an invalid email/password.
|
|
6826
6964
|
*
|
|
6965
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
6966
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6967
|
+
*
|
|
6827
6968
|
* Note: The user's password is NOT the password used to access the user's email account. The
|
|
6828
6969
|
* email address serves as a unique identifier for the user, and the password is used to access
|
|
6829
6970
|
* the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
|
|
6830
6971
|
*
|
|
6972
|
+
*
|
|
6831
6973
|
* @param auth - The {@link Auth} instance.
|
|
6832
6974
|
* @param email - The users email address.
|
|
6833
6975
|
* @param password - The users password.
|
|
@@ -6836,6 +6978,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6836
6978
|
*/
|
|
6837
6979
|
function signInWithEmailAndPassword(auth, email, password) {
|
|
6838
6980
|
var _this = this;
|
|
6981
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
6982
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
6983
|
+
}
|
|
6839
6984
|
return signInWithCredential(util.getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(function (error) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
6840
6985
|
return tslib.__generator(this, function (_a) {
|
|
6841
6986
|
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
@@ -6947,6 +7092,9 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
6947
7092
|
*
|
|
6948
7093
|
* Fails with an error if the email address is invalid or OTP in email link expires.
|
|
6949
7094
|
*
|
|
7095
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7096
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7097
|
+
*
|
|
6950
7098
|
* Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
|
|
6951
7099
|
*
|
|
6952
7100
|
* @example
|
|
@@ -6970,6 +7118,7 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
6970
7118
|
* }
|
|
6971
7119
|
* ```
|
|
6972
7120
|
*
|
|
7121
|
+
*
|
|
6973
7122
|
* @param auth - The {@link Auth} instance.
|
|
6974
7123
|
* @param email - The user's email address.
|
|
6975
7124
|
* @param emailLink - The link sent to the user's email address.
|
|
@@ -6980,6 +7129,9 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
6980
7129
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
6981
7130
|
var authModular, credential;
|
|
6982
7131
|
return tslib.__generator(this, function (_a) {
|
|
7132
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
7133
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
7134
|
+
}
|
|
6983
7135
|
authModular = util.getModularInstance(auth);
|
|
6984
7136
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
6985
7137
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
@@ -7293,6 +7445,9 @@ function updateProfile(user, _a) {
|
|
|
7293
7445
|
* An email will be sent to the original email address (if it was set) that allows to revoke the
|
|
7294
7446
|
* email address change, in order to protect them from account hijacking.
|
|
7295
7447
|
*
|
|
7448
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
7449
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
7450
|
+
*
|
|
7296
7451
|
* Important: this is a security sensitive operation that requires the user to have recently signed
|
|
7297
7452
|
* in. If this requirement isn't met, ask the user to authenticate again and then call
|
|
7298
7453
|
* {@link reauthenticateWithCredential}.
|
|
@@ -7306,7 +7461,11 @@ function updateProfile(user, _a) {
|
|
|
7306
7461
|
* @public
|
|
7307
7462
|
*/
|
|
7308
7463
|
function updateEmail(user, newEmail) {
|
|
7309
|
-
|
|
7464
|
+
var userInternal = util.getModularInstance(user);
|
|
7465
|
+
if (app._isFirebaseServerApp(userInternal.auth.app)) {
|
|
7466
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
|
|
7467
|
+
}
|
|
7468
|
+
return updateEmailOrPassword(userInternal, newEmail, null);
|
|
7310
7469
|
}
|
|
7311
7470
|
/**
|
|
7312
7471
|
* Updates the user's password.
|
|
@@ -7511,7 +7670,8 @@ function getAdditionalUserInfo(userCredential) {
|
|
|
7511
7670
|
* remembered or not. It also makes it easier to never persist the `Auth` state for applications
|
|
7512
7671
|
* that are shared by other users or have sensitive data.
|
|
7513
7672
|
*
|
|
7514
|
-
* This method does not work in a Node.js environment
|
|
7673
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
7674
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7515
7675
|
*
|
|
7516
7676
|
* @example
|
|
7517
7677
|
* ```javascript
|
|
@@ -7662,6 +7822,9 @@ function useDeviceLanguage(auth) {
|
|
|
7662
7822
|
* The operation fails with an error if the user to be updated belongs to a different Firebase
|
|
7663
7823
|
* project.
|
|
7664
7824
|
*
|
|
7825
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7826
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7827
|
+
*
|
|
7665
7828
|
* @param auth - The {@link Auth} instance.
|
|
7666
7829
|
* @param user - The new {@link User}.
|
|
7667
7830
|
*
|
|
@@ -7673,6 +7836,10 @@ function updateCurrentUser(auth, user) {
|
|
|
7673
7836
|
/**
|
|
7674
7837
|
* Signs out the current user.
|
|
7675
7838
|
*
|
|
7839
|
+
* @remarks
|
|
7840
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7841
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7842
|
+
*
|
|
7676
7843
|
* @param auth - The {@link Auth} instance.
|
|
7677
7844
|
*
|
|
7678
7845
|
* @public
|
|
@@ -8015,7 +8182,7 @@ function multiFactor(user) {
|
|
|
8015
8182
|
}
|
|
8016
8183
|
|
|
8017
8184
|
var name = "@firebase/auth";
|
|
8018
|
-
var version = "1.
|
|
8185
|
+
var version = "1.7.0-canary.42fcdfe4c";
|
|
8019
8186
|
|
|
8020
8187
|
/**
|
|
8021
8188
|
* @license
|
|
@@ -8525,6 +8692,7 @@ exports._link = _link;
|
|
|
8525
8692
|
exports._performApiRequest = _performApiRequest;
|
|
8526
8693
|
exports._persistenceKeyName = _persistenceKeyName;
|
|
8527
8694
|
exports._reauthenticate = _reauthenticate;
|
|
8695
|
+
exports._serverAppCurrentUserOperationNotSupportedError = _serverAppCurrentUserOperationNotSupportedError;
|
|
8528
8696
|
exports._signInWithCredential = _signInWithCredential;
|
|
8529
8697
|
exports.applyActionCode = applyActionCode;
|
|
8530
8698
|
exports.beforeAuthStateChanged = beforeAuthStateChanged;
|
|
@@ -8589,4 +8757,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
8589
8757
|
exports.validatePassword = validatePassword;
|
|
8590
8758
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
8591
8759
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
8592
|
-
//# sourceMappingURL=totp-
|
|
8760
|
+
//# sourceMappingURL=totp-fbe187a4.js.map
|