@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,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var util = require('@firebase/util');
|
|
4
3
|
var app = require('@firebase/app');
|
|
4
|
+
var util = require('@firebase/util');
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var component = require('@firebase/component');
|
|
7
7
|
var logger = require('@firebase/logger');
|
|
@@ -383,6 +383,9 @@ function _errorWithCustomMessage(auth, code, message) {
|
|
|
383
383
|
appName: auth.name
|
|
384
384
|
});
|
|
385
385
|
}
|
|
386
|
+
function _serverAppCurrentUserOperationNotSupportedError(auth) {
|
|
387
|
+
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');
|
|
388
|
+
}
|
|
386
389
|
function _assertInstanceOf(auth, object, instance) {
|
|
387
390
|
const constructorInstance = instance;
|
|
388
391
|
if (!(object instanceof constructorInstance)) {
|
|
@@ -1491,11 +1494,16 @@ class StsTokenManager {
|
|
|
1491
1494
|
: _tokenExpiresIn(response.idToken);
|
|
1492
1495
|
this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
|
|
1493
1496
|
}
|
|
1497
|
+
updateFromIdToken(idToken) {
|
|
1498
|
+
_assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1499
|
+
const expiresIn = _tokenExpiresIn(idToken);
|
|
1500
|
+
this.updateTokensAndExpiration(idToken, null, expiresIn);
|
|
1501
|
+
}
|
|
1494
1502
|
async getToken(auth, forceRefresh = false) {
|
|
1495
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1496
1503
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1497
1504
|
return this.accessToken;
|
|
1498
1505
|
}
|
|
1506
|
+
_assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1499
1507
|
if (this.refreshToken) {
|
|
1500
1508
|
await this.refresh(auth, this.refreshToken);
|
|
1501
1509
|
return this.accessToken;
|
|
@@ -1675,6 +1683,9 @@ class UserImpl {
|
|
|
1675
1683
|
}
|
|
1676
1684
|
}
|
|
1677
1685
|
async delete() {
|
|
1686
|
+
if (app._isFirebaseServerApp(this.auth.app)) {
|
|
1687
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth));
|
|
1688
|
+
}
|
|
1678
1689
|
const idToken = await this.getIdToken();
|
|
1679
1690
|
await _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken }));
|
|
1680
1691
|
this.stsTokenManager.clearRefreshToken();
|
|
@@ -1758,6 +1769,44 @@ class UserImpl {
|
|
|
1758
1769
|
await _reloadWithoutSaving(user);
|
|
1759
1770
|
return user;
|
|
1760
1771
|
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Initialize a User from an idToken server response
|
|
1774
|
+
* @param auth
|
|
1775
|
+
* @param idTokenResponse
|
|
1776
|
+
*/
|
|
1777
|
+
static async _fromGetAccountInfoResponse(auth, response, idToken) {
|
|
1778
|
+
const coreAccount = response.users[0];
|
|
1779
|
+
_assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1780
|
+
const providerData = coreAccount.providerUserInfo !== undefined
|
|
1781
|
+
? extractProviderData(coreAccount.providerUserInfo)
|
|
1782
|
+
: [];
|
|
1783
|
+
const isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);
|
|
1784
|
+
const stsTokenManager = new StsTokenManager();
|
|
1785
|
+
stsTokenManager.updateFromIdToken(idToken);
|
|
1786
|
+
// Initialize the Firebase Auth user.
|
|
1787
|
+
const user = new UserImpl({
|
|
1788
|
+
uid: coreAccount.localId,
|
|
1789
|
+
auth,
|
|
1790
|
+
stsTokenManager,
|
|
1791
|
+
isAnonymous
|
|
1792
|
+
});
|
|
1793
|
+
// update the user with data from the GetAccountInfo response.
|
|
1794
|
+
const updates = {
|
|
1795
|
+
uid: coreAccount.localId,
|
|
1796
|
+
displayName: coreAccount.displayName || null,
|
|
1797
|
+
photoURL: coreAccount.photoUrl || null,
|
|
1798
|
+
email: coreAccount.email || null,
|
|
1799
|
+
emailVerified: coreAccount.emailVerified || false,
|
|
1800
|
+
phoneNumber: coreAccount.phoneNumber || null,
|
|
1801
|
+
tenantId: coreAccount.tenantId || null,
|
|
1802
|
+
providerData,
|
|
1803
|
+
metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),
|
|
1804
|
+
isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&
|
|
1805
|
+
!(providerData === null || providerData === void 0 ? void 0 : providerData.length)
|
|
1806
|
+
};
|
|
1807
|
+
Object.assign(user, updates);
|
|
1808
|
+
return user;
|
|
1809
|
+
}
|
|
1761
1810
|
}
|
|
1762
1811
|
|
|
1763
1812
|
/**
|
|
@@ -2501,8 +2550,32 @@ class AuthImpl {
|
|
|
2501
2550
|
// Skip blocking callbacks, they should not apply to a change in another tab.
|
|
2502
2551
|
await this._updateCurrentUser(user, /* skipBeforeStateCallbacks */ true);
|
|
2503
2552
|
}
|
|
2553
|
+
async initializeCurrentUserFromIdToken(idToken) {
|
|
2554
|
+
try {
|
|
2555
|
+
const response = await getAccountInfo(this, { idToken });
|
|
2556
|
+
const user = await UserImpl._fromGetAccountInfoResponse(this, response, idToken);
|
|
2557
|
+
await this.directlySetCurrentUser(user);
|
|
2558
|
+
}
|
|
2559
|
+
catch (err) {
|
|
2560
|
+
console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err);
|
|
2561
|
+
await this.directlySetCurrentUser(null);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2504
2564
|
async initializeCurrentUser(popupRedirectResolver) {
|
|
2505
2565
|
var _a;
|
|
2566
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
2567
|
+
const idToken = this.app.settings.authIdToken;
|
|
2568
|
+
if (idToken) {
|
|
2569
|
+
// Start the auth operation in the next tick to allow a moment for the customer's app to
|
|
2570
|
+
// attach an emulator, if desired.
|
|
2571
|
+
return new Promise(resolve => {
|
|
2572
|
+
setTimeout(() => this.initializeCurrentUserFromIdToken(idToken).then(resolve, resolve));
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
else {
|
|
2576
|
+
return this.directlySetCurrentUser(null);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2506
2579
|
// First check to see if we have a pending redirect event.
|
|
2507
2580
|
const previouslyStoredUser = (await this.assertedPersistence.getCurrentUser());
|
|
2508
2581
|
let futureCurrentUser = previouslyStoredUser;
|
|
@@ -2608,6 +2681,9 @@ class AuthImpl {
|
|
|
2608
2681
|
this._deleted = true;
|
|
2609
2682
|
}
|
|
2610
2683
|
async updateCurrentUser(userExtern) {
|
|
2684
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
2685
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
|
|
2686
|
+
}
|
|
2611
2687
|
// The public updateCurrentUser method needs to make a copy of the user,
|
|
2612
2688
|
// and also check that the project matches
|
|
2613
2689
|
const user = userExtern
|
|
@@ -2634,6 +2710,9 @@ class AuthImpl {
|
|
|
2634
2710
|
});
|
|
2635
2711
|
}
|
|
2636
2712
|
async signOut() {
|
|
2713
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
2714
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
|
|
2715
|
+
}
|
|
2637
2716
|
// Run first, to block _setRedirectUser() if any callbacks fail.
|
|
2638
2717
|
await this.beforeStateQueue.runMiddleware(null);
|
|
2639
2718
|
// Clear the redirect user when signOut is called
|
|
@@ -2645,6 +2724,9 @@ class AuthImpl {
|
|
|
2645
2724
|
return this._updateCurrentUser(null, /* skipBeforeStateCallbacks */ true);
|
|
2646
2725
|
}
|
|
2647
2726
|
setPersistence(persistence) {
|
|
2727
|
+
if (app._isFirebaseServerApp(this.app)) {
|
|
2728
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
|
|
2729
|
+
}
|
|
2648
2730
|
return this.queue(async () => {
|
|
2649
2731
|
await this.assertedPersistence.setPersistence(_getInstance(persistence));
|
|
2650
2732
|
});
|
|
@@ -5090,12 +5172,18 @@ function providerIdForResponse(response) {
|
|
|
5090
5172
|
* If there is already an anonymous user signed in, that user will be returned; otherwise, a
|
|
5091
5173
|
* new anonymous user identity will be created and returned.
|
|
5092
5174
|
*
|
|
5175
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
5176
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5177
|
+
*
|
|
5093
5178
|
* @param auth - The {@link Auth} instance.
|
|
5094
5179
|
*
|
|
5095
5180
|
* @public
|
|
5096
5181
|
*/
|
|
5097
5182
|
async function signInAnonymously(auth) {
|
|
5098
5183
|
var _a;
|
|
5184
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5185
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5186
|
+
}
|
|
5099
5187
|
const authInternal = _castAuth(auth);
|
|
5100
5188
|
await authInternal._initializationPromise;
|
|
5101
5189
|
if ((_a = authInternal.currentUser) === null || _a === void 0 ? void 0 : _a.isAnonymous) {
|
|
@@ -5256,6 +5344,9 @@ async function _assertLinkedStatus(expected, user, provider) {
|
|
|
5256
5344
|
*/
|
|
5257
5345
|
async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
5258
5346
|
const { auth } = user;
|
|
5347
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5348
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5349
|
+
}
|
|
5259
5350
|
const operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
5260
5351
|
try {
|
|
5261
5352
|
const response = await _logoutIfInvalidated(user, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential, user), bypassAuthState);
|
|
@@ -5292,6 +5383,9 @@ async function _reauthenticate(user, credential, bypassAuthState = false) {
|
|
|
5292
5383
|
* limitations under the License.
|
|
5293
5384
|
*/
|
|
5294
5385
|
async function _signInWithCredential(auth, credential, bypassAuthState = false) {
|
|
5386
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5387
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5388
|
+
}
|
|
5295
5389
|
const operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
5296
5390
|
const response = await _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential);
|
|
5297
5391
|
const userCredential = await UserCredentialImpl._fromIdTokenResponse(auth, operationType, response);
|
|
@@ -5306,6 +5400,9 @@ async function _signInWithCredential(auth, credential, bypassAuthState = false)
|
|
|
5306
5400
|
* @remarks
|
|
5307
5401
|
* An {@link AuthProvider} can be used to generate the credential.
|
|
5308
5402
|
*
|
|
5403
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
5404
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5405
|
+
*
|
|
5309
5406
|
* @param auth - The {@link Auth} instance.
|
|
5310
5407
|
* @param credential - The auth credential.
|
|
5311
5408
|
*
|
|
@@ -5338,6 +5435,9 @@ async function linkWithCredential(user, credential) {
|
|
|
5338
5435
|
* attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
|
|
5339
5436
|
* or a `TOKEN_EXPIRED` error.
|
|
5340
5437
|
*
|
|
5438
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
5439
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
5440
|
+
*
|
|
5341
5441
|
* @param user - The user.
|
|
5342
5442
|
* @param credential - The auth credential.
|
|
5343
5443
|
*
|
|
@@ -5394,12 +5494,18 @@ async function signInWithCustomToken$1(auth, request) {
|
|
|
5394
5494
|
*
|
|
5395
5495
|
* Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
|
|
5396
5496
|
*
|
|
5497
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
5498
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5499
|
+
*
|
|
5397
5500
|
* @param auth - The {@link Auth} instance.
|
|
5398
5501
|
* @param customToken - The custom token to sign in with.
|
|
5399
5502
|
*
|
|
5400
5503
|
* @public
|
|
5401
5504
|
*/
|
|
5402
5505
|
async function signInWithCustomToken(auth, customToken) {
|
|
5506
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5507
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5508
|
+
}
|
|
5403
5509
|
const authInternal = _castAuth(auth);
|
|
5404
5510
|
const response = await signInWithCustomToken$1(authInternal, {
|
|
5405
5511
|
token: customToken,
|
|
@@ -5687,6 +5793,9 @@ async function verifyPasswordResetCode(auth, code) {
|
|
|
5687
5793
|
*
|
|
5688
5794
|
* User account creation can fail if the account already exists or the password is invalid.
|
|
5689
5795
|
*
|
|
5796
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
5797
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5798
|
+
*
|
|
5690
5799
|
* Note: The email address acts as a unique identifier for the user and enables an email-based
|
|
5691
5800
|
* password reset. This function will create a new user account and set the initial user password.
|
|
5692
5801
|
*
|
|
@@ -5697,6 +5806,9 @@ async function verifyPasswordResetCode(auth, code) {
|
|
|
5697
5806
|
* @public
|
|
5698
5807
|
*/
|
|
5699
5808
|
async function createUserWithEmailAndPassword(auth, email, password) {
|
|
5809
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5810
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5811
|
+
}
|
|
5700
5812
|
const authInternal = _castAuth(auth);
|
|
5701
5813
|
const request = {
|
|
5702
5814
|
returnSecureToken: true,
|
|
@@ -5723,10 +5835,14 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5723
5835
|
* When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
|
|
5724
5836
|
* this method fails with "auth/invalid-credential" in case of an invalid email/password.
|
|
5725
5837
|
*
|
|
5838
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
5839
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5840
|
+
*
|
|
5726
5841
|
* Note: The user's password is NOT the password used to access the user's email account. The
|
|
5727
5842
|
* email address serves as a unique identifier for the user, and the password is used to access
|
|
5728
5843
|
* the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
|
|
5729
5844
|
*
|
|
5845
|
+
*
|
|
5730
5846
|
* @param auth - The {@link Auth} instance.
|
|
5731
5847
|
* @param email - The users email address.
|
|
5732
5848
|
* @param password - The users password.
|
|
@@ -5734,6 +5850,9 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5734
5850
|
* @public
|
|
5735
5851
|
*/
|
|
5736
5852
|
function signInWithEmailAndPassword(auth, email, password) {
|
|
5853
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5854
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5855
|
+
}
|
|
5737
5856
|
return signInWithCredential(util.getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(async (error) => {
|
|
5738
5857
|
if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
|
|
5739
5858
|
void recachePasswordPolicy(auth);
|
|
@@ -5832,6 +5951,9 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
5832
5951
|
*
|
|
5833
5952
|
* Fails with an error if the email address is invalid or OTP in email link expires.
|
|
5834
5953
|
*
|
|
5954
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
5955
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
5956
|
+
*
|
|
5835
5957
|
* Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
|
|
5836
5958
|
*
|
|
5837
5959
|
* @example
|
|
@@ -5855,6 +5977,7 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
5855
5977
|
* }
|
|
5856
5978
|
* ```
|
|
5857
5979
|
*
|
|
5980
|
+
*
|
|
5858
5981
|
* @param auth - The {@link Auth} instance.
|
|
5859
5982
|
* @param email - The user's email address.
|
|
5860
5983
|
* @param emailLink - The link sent to the user's email address.
|
|
@@ -5862,6 +5985,9 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
5862
5985
|
* @public
|
|
5863
5986
|
*/
|
|
5864
5987
|
async function signInWithEmailLink(auth, email, emailLink) {
|
|
5988
|
+
if (app._isFirebaseServerApp(auth.app)) {
|
|
5989
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
5990
|
+
}
|
|
5865
5991
|
const authModular = util.getModularInstance(auth);
|
|
5866
5992
|
const credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
5867
5993
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
@@ -6108,6 +6234,9 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
|
|
|
6108
6234
|
* An email will be sent to the original email address (if it was set) that allows to revoke the
|
|
6109
6235
|
* email address change, in order to protect them from account hijacking.
|
|
6110
6236
|
*
|
|
6237
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
6238
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
6239
|
+
*
|
|
6111
6240
|
* Important: this is a security sensitive operation that requires the user to have recently signed
|
|
6112
6241
|
* in. If this requirement isn't met, ask the user to authenticate again and then call
|
|
6113
6242
|
* {@link reauthenticateWithCredential}.
|
|
@@ -6121,7 +6250,11 @@ async function updateProfile(user, { displayName, photoURL: photoUrl }) {
|
|
|
6121
6250
|
* @public
|
|
6122
6251
|
*/
|
|
6123
6252
|
function updateEmail(user, newEmail) {
|
|
6124
|
-
|
|
6253
|
+
const userInternal = util.getModularInstance(user);
|
|
6254
|
+
if (app._isFirebaseServerApp(userInternal.auth.app)) {
|
|
6255
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
|
|
6256
|
+
}
|
|
6257
|
+
return updateEmailOrPassword(userInternal, newEmail, null);
|
|
6125
6258
|
}
|
|
6126
6259
|
/**
|
|
6127
6260
|
* Updates the user's password.
|
|
@@ -6298,7 +6431,8 @@ function getAdditionalUserInfo(userCredential) {
|
|
|
6298
6431
|
* remembered or not. It also makes it easier to never persist the `Auth` state for applications
|
|
6299
6432
|
* that are shared by other users or have sensitive data.
|
|
6300
6433
|
*
|
|
6301
|
-
* This method does not work in a Node.js environment
|
|
6434
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
6435
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6302
6436
|
*
|
|
6303
6437
|
* @example
|
|
6304
6438
|
* ```javascript
|
|
@@ -6444,6 +6578,9 @@ function useDeviceLanguage(auth) {
|
|
|
6444
6578
|
* The operation fails with an error if the user to be updated belongs to a different Firebase
|
|
6445
6579
|
* project.
|
|
6446
6580
|
*
|
|
6581
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6582
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6583
|
+
*
|
|
6447
6584
|
* @param auth - The {@link Auth} instance.
|
|
6448
6585
|
* @param user - The new {@link User}.
|
|
6449
6586
|
*
|
|
@@ -6455,6 +6592,10 @@ function updateCurrentUser(auth, user) {
|
|
|
6455
6592
|
/**
|
|
6456
6593
|
* Signs out the current user.
|
|
6457
6594
|
*
|
|
6595
|
+
* @remarks
|
|
6596
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6597
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6598
|
+
*
|
|
6458
6599
|
* @param auth - The {@link Auth} instance.
|
|
6459
6600
|
*
|
|
6460
6601
|
* @public
|
|
@@ -7610,7 +7751,7 @@ function _isEmptyString(input) {
|
|
|
7610
7751
|
}
|
|
7611
7752
|
|
|
7612
7753
|
var name = "@firebase/auth";
|
|
7613
|
-
var version = "1.
|
|
7754
|
+
var version = "1.7.0-canary.42fcdfe4c";
|
|
7614
7755
|
|
|
7615
7756
|
/**
|
|
7616
7757
|
* @license
|
|
@@ -7811,6 +7952,7 @@ exports._performApiRequest = _performApiRequest;
|
|
|
7811
7952
|
exports._persistenceKeyName = _persistenceKeyName;
|
|
7812
7953
|
exports._reauthenticate = _reauthenticate;
|
|
7813
7954
|
exports._recaptchaV2ScriptUrl = _recaptchaV2ScriptUrl;
|
|
7955
|
+
exports._serverAppCurrentUserOperationNotSupportedError = _serverAppCurrentUserOperationNotSupportedError;
|
|
7814
7956
|
exports._setExternalJSProvider = _setExternalJSProvider;
|
|
7815
7957
|
exports._setWindowLocation = _setWindowLocation;
|
|
7816
7958
|
exports._signInWithCredential = _signInWithCredential;
|
|
@@ -7871,4 +8013,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
7871
8013
|
exports.validatePassword = validatePassword;
|
|
7872
8014
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
7873
8015
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
7874
|
-
//# sourceMappingURL=register-
|
|
8016
|
+
//# sourceMappingURL=register-4ce22251.js.map
|