@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,6 +1,6 @@
|
|
|
1
1
|
import { __spreadArray, __assign, __awaiter, __generator, __rest, __extends } from 'tslib';
|
|
2
|
+
import { SDK_VERSION, _isFirebaseServerApp, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
|
|
2
3
|
import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, getModularInstance, base64Decode, isIE, getUA, createSubscribe, deepEqual, querystringDecode, extractQuerystring, isEmpty, getExperimentalSetting, getDefaultEmulatorHost } from '@firebase/util';
|
|
3
|
-
import { SDK_VERSION, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
|
|
4
4
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
5
5
|
import { Component } from '@firebase/component';
|
|
6
6
|
|
|
@@ -499,6 +499,9 @@ function _errorWithCustomMessage(auth, code, message) {
|
|
|
499
499
|
appName: auth.name
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
|
+
function _serverAppCurrentUserOperationNotSupportedError(auth) {
|
|
503
|
+
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');
|
|
504
|
+
}
|
|
502
505
|
function _assertInstanceOf(auth, object, instance) {
|
|
503
506
|
var constructorInstance = instance;
|
|
504
507
|
if (!(object instanceof constructorInstance)) {
|
|
@@ -1786,16 +1789,21 @@ var StsTokenManager = /** @class */ (function () {
|
|
|
1786
1789
|
: _tokenExpiresIn(response.idToken);
|
|
1787
1790
|
this.updateTokensAndExpiration(response.idToken, response.refreshToken, expiresIn);
|
|
1788
1791
|
};
|
|
1792
|
+
StsTokenManager.prototype.updateFromIdToken = function (idToken) {
|
|
1793
|
+
_assert(idToken.length !== 0, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
1794
|
+
var expiresIn = _tokenExpiresIn(idToken);
|
|
1795
|
+
this.updateTokensAndExpiration(idToken, null, expiresIn);
|
|
1796
|
+
};
|
|
1789
1797
|
StsTokenManager.prototype.getToken = function (auth, forceRefresh) {
|
|
1790
1798
|
if (forceRefresh === void 0) { forceRefresh = false; }
|
|
1791
1799
|
return __awaiter(this, void 0, void 0, function () {
|
|
1792
1800
|
return __generator(this, function (_a) {
|
|
1793
1801
|
switch (_a.label) {
|
|
1794
1802
|
case 0:
|
|
1795
|
-
_assert(!this.accessToken || this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1796
1803
|
if (!forceRefresh && this.accessToken && !this.isExpired) {
|
|
1797
1804
|
return [2 /*return*/, this.accessToken];
|
|
1798
1805
|
}
|
|
1806
|
+
_assert(this.refreshToken, auth, "user-token-expired" /* AuthErrorCode.TOKEN_EXPIRED */);
|
|
1799
1807
|
if (!this.refreshToken) return [3 /*break*/, 2];
|
|
1800
1808
|
return [4 /*yield*/, this.refresh(auth, this.refreshToken)];
|
|
1801
1809
|
case 1:
|
|
@@ -2019,7 +2027,11 @@ var UserImpl = /** @class */ (function () {
|
|
|
2019
2027
|
var idToken;
|
|
2020
2028
|
return __generator(this, function (_a) {
|
|
2021
2029
|
switch (_a.label) {
|
|
2022
|
-
case 0:
|
|
2030
|
+
case 0:
|
|
2031
|
+
if (_isFirebaseServerApp(this.auth.app)) {
|
|
2032
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this.auth))];
|
|
2033
|
+
}
|
|
2034
|
+
return [4 /*yield*/, this.getIdToken()];
|
|
2023
2035
|
case 1:
|
|
2024
2036
|
idToken = _a.sent();
|
|
2025
2037
|
return [4 /*yield*/, _logoutIfInvalidated(this, deleteAccount(this.auth, { idToken: idToken }))];
|
|
@@ -2124,6 +2136,47 @@ var UserImpl = /** @class */ (function () {
|
|
|
2124
2136
|
});
|
|
2125
2137
|
});
|
|
2126
2138
|
};
|
|
2139
|
+
/**
|
|
2140
|
+
* Initialize a User from an idToken server response
|
|
2141
|
+
* @param auth
|
|
2142
|
+
* @param idTokenResponse
|
|
2143
|
+
*/
|
|
2144
|
+
UserImpl._fromGetAccountInfoResponse = function (auth, response, idToken) {
|
|
2145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2146
|
+
var coreAccount, providerData, isAnonymous, stsTokenManager, user, updates;
|
|
2147
|
+
return __generator(this, function (_a) {
|
|
2148
|
+
coreAccount = response.users[0];
|
|
2149
|
+
_assert(coreAccount.localId !== undefined, "internal-error" /* AuthErrorCode.INTERNAL_ERROR */);
|
|
2150
|
+
providerData = coreAccount.providerUserInfo !== undefined
|
|
2151
|
+
? extractProviderData(coreAccount.providerUserInfo)
|
|
2152
|
+
: [];
|
|
2153
|
+
isAnonymous = !(coreAccount.email && coreAccount.passwordHash) && !(providerData === null || providerData === void 0 ? void 0 : providerData.length);
|
|
2154
|
+
stsTokenManager = new StsTokenManager();
|
|
2155
|
+
stsTokenManager.updateFromIdToken(idToken);
|
|
2156
|
+
user = new UserImpl({
|
|
2157
|
+
uid: coreAccount.localId,
|
|
2158
|
+
auth: auth,
|
|
2159
|
+
stsTokenManager: stsTokenManager,
|
|
2160
|
+
isAnonymous: isAnonymous
|
|
2161
|
+
});
|
|
2162
|
+
updates = {
|
|
2163
|
+
uid: coreAccount.localId,
|
|
2164
|
+
displayName: coreAccount.displayName || null,
|
|
2165
|
+
photoURL: coreAccount.photoUrl || null,
|
|
2166
|
+
email: coreAccount.email || null,
|
|
2167
|
+
emailVerified: coreAccount.emailVerified || false,
|
|
2168
|
+
phoneNumber: coreAccount.phoneNumber || null,
|
|
2169
|
+
tenantId: coreAccount.tenantId || null,
|
|
2170
|
+
providerData: providerData,
|
|
2171
|
+
metadata: new UserMetadata(coreAccount.createdAt, coreAccount.lastLoginAt),
|
|
2172
|
+
isAnonymous: !(coreAccount.email && coreAccount.passwordHash) &&
|
|
2173
|
+
!(providerData === null || providerData === void 0 ? void 0 : providerData.length)
|
|
2174
|
+
};
|
|
2175
|
+
Object.assign(user, updates);
|
|
2176
|
+
return [2 /*return*/, user];
|
|
2177
|
+
});
|
|
2178
|
+
});
|
|
2179
|
+
};
|
|
2127
2180
|
return UserImpl;
|
|
2128
2181
|
}());
|
|
2129
2182
|
|
|
@@ -3025,13 +3078,59 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3025
3078
|
});
|
|
3026
3079
|
});
|
|
3027
3080
|
};
|
|
3081
|
+
AuthImpl.prototype.initializeCurrentUserFromIdToken = function (idToken) {
|
|
3082
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3083
|
+
var response, user, err_1;
|
|
3084
|
+
return __generator(this, function (_a) {
|
|
3085
|
+
switch (_a.label) {
|
|
3086
|
+
case 0:
|
|
3087
|
+
_a.trys.push([0, 4, , 6]);
|
|
3088
|
+
return [4 /*yield*/, getAccountInfo(this, { idToken: idToken })];
|
|
3089
|
+
case 1:
|
|
3090
|
+
response = _a.sent();
|
|
3091
|
+
return [4 /*yield*/, UserImpl._fromGetAccountInfoResponse(this, response, idToken)];
|
|
3092
|
+
case 2:
|
|
3093
|
+
user = _a.sent();
|
|
3094
|
+
return [4 /*yield*/, this.directlySetCurrentUser(user)];
|
|
3095
|
+
case 3:
|
|
3096
|
+
_a.sent();
|
|
3097
|
+
return [3 /*break*/, 6];
|
|
3098
|
+
case 4:
|
|
3099
|
+
err_1 = _a.sent();
|
|
3100
|
+
console.warn('FirebaseServerApp could not login user with provided authIdToken: ', err_1);
|
|
3101
|
+
return [4 /*yield*/, this.directlySetCurrentUser(null)];
|
|
3102
|
+
case 5:
|
|
3103
|
+
_a.sent();
|
|
3104
|
+
return [3 /*break*/, 6];
|
|
3105
|
+
case 6: return [2 /*return*/];
|
|
3106
|
+
}
|
|
3107
|
+
});
|
|
3108
|
+
});
|
|
3109
|
+
};
|
|
3028
3110
|
AuthImpl.prototype.initializeCurrentUser = function (popupRedirectResolver) {
|
|
3029
3111
|
var _a;
|
|
3030
3112
|
return __awaiter(this, void 0, void 0, function () {
|
|
3031
|
-
var previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
|
|
3113
|
+
var idToken_1, previouslyStoredUser, futureCurrentUser, needsTocheckMiddleware, redirectUserEventId, storedUserEventId, result, e_2;
|
|
3114
|
+
var _this = this;
|
|
3032
3115
|
return __generator(this, function (_b) {
|
|
3033
3116
|
switch (_b.label) {
|
|
3034
|
-
case 0:
|
|
3117
|
+
case 0:
|
|
3118
|
+
if (_isFirebaseServerApp(this.app)) {
|
|
3119
|
+
idToken_1 = this.app.settings.authIdToken;
|
|
3120
|
+
if (idToken_1) {
|
|
3121
|
+
// Start the auth operation in the next tick to allow a moment for the customer's app to
|
|
3122
|
+
// attach an emulator, if desired.
|
|
3123
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
3124
|
+
setTimeout(function () {
|
|
3125
|
+
return _this.initializeCurrentUserFromIdToken(idToken_1).then(resolve, resolve);
|
|
3126
|
+
});
|
|
3127
|
+
})];
|
|
3128
|
+
}
|
|
3129
|
+
else {
|
|
3130
|
+
return [2 /*return*/, this.directlySetCurrentUser(null)];
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
return [4 /*yield*/, this.assertedPersistence.getCurrentUser()];
|
|
3035
3134
|
case 1:
|
|
3036
3135
|
previouslyStoredUser = (_b.sent());
|
|
3037
3136
|
futureCurrentUser = previouslyStoredUser;
|
|
@@ -3173,6 +3272,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3173
3272
|
return __awaiter(this, void 0, void 0, function () {
|
|
3174
3273
|
var user;
|
|
3175
3274
|
return __generator(this, function (_a) {
|
|
3275
|
+
if (_isFirebaseServerApp(this.app)) {
|
|
3276
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
|
|
3277
|
+
}
|
|
3176
3278
|
user = userExtern
|
|
3177
3279
|
? getModularInstance(userExtern)
|
|
3178
3280
|
: null;
|
|
@@ -3220,9 +3322,12 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3220
3322
|
return __awaiter(this, void 0, void 0, function () {
|
|
3221
3323
|
return __generator(this, function (_a) {
|
|
3222
3324
|
switch (_a.label) {
|
|
3223
|
-
case 0:
|
|
3224
|
-
|
|
3225
|
-
|
|
3325
|
+
case 0:
|
|
3326
|
+
if (_isFirebaseServerApp(this.app)) {
|
|
3327
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this))];
|
|
3328
|
+
}
|
|
3329
|
+
// Run first, to block _setRedirectUser() if any callbacks fail.
|
|
3330
|
+
return [4 /*yield*/, this.beforeStateQueue.runMiddleware(null)];
|
|
3226
3331
|
case 1:
|
|
3227
3332
|
// Run first, to block _setRedirectUser() if any callbacks fail.
|
|
3228
3333
|
_a.sent();
|
|
@@ -3241,6 +3346,9 @@ var AuthImpl = /** @class */ (function () {
|
|
|
3241
3346
|
};
|
|
3242
3347
|
AuthImpl.prototype.setPersistence = function (persistence) {
|
|
3243
3348
|
var _this = this;
|
|
3349
|
+
if (_isFirebaseServerApp(this.app)) {
|
|
3350
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(this));
|
|
3351
|
+
}
|
|
3244
3352
|
return this.queue(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
3245
3353
|
return __generator(this, function (_a) {
|
|
3246
3354
|
switch (_a.label) {
|
|
@@ -6028,6 +6136,9 @@ function providerIdForResponse(response) {
|
|
|
6028
6136
|
* If there is already an anonymous user signed in, that user will be returned; otherwise, a
|
|
6029
6137
|
* new anonymous user identity will be created and returned.
|
|
6030
6138
|
*
|
|
6139
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6140
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6141
|
+
*
|
|
6031
6142
|
* @param auth - The {@link Auth} instance.
|
|
6032
6143
|
*
|
|
6033
6144
|
* @public
|
|
@@ -6039,6 +6150,9 @@ function signInAnonymously(auth) {
|
|
|
6039
6150
|
return __generator(this, function (_b) {
|
|
6040
6151
|
switch (_b.label) {
|
|
6041
6152
|
case 0:
|
|
6153
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
6154
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6155
|
+
}
|
|
6042
6156
|
authInternal = _castAuth(auth);
|
|
6043
6157
|
return [4 /*yield*/, authInternal._initializationPromise];
|
|
6044
6158
|
case 1:
|
|
@@ -6270,6 +6384,9 @@ function _reauthenticate(user, credential, bypassAuthState) {
|
|
|
6270
6384
|
switch (_a.label) {
|
|
6271
6385
|
case 0:
|
|
6272
6386
|
auth = user.auth;
|
|
6387
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
6388
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6389
|
+
}
|
|
6273
6390
|
operationType = "reauthenticate" /* OperationType.REAUTHENTICATE */;
|
|
6274
6391
|
_a.label = 1;
|
|
6275
6392
|
case 1:
|
|
@@ -6319,6 +6436,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6319
6436
|
return __generator(this, function (_a) {
|
|
6320
6437
|
switch (_a.label) {
|
|
6321
6438
|
case 0:
|
|
6439
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
6440
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6441
|
+
}
|
|
6322
6442
|
operationType = "signIn" /* OperationType.SIGN_IN */;
|
|
6323
6443
|
return [4 /*yield*/, _processCredentialSavingMfaContextIfNecessary(auth, operationType, credential)];
|
|
6324
6444
|
case 1:
|
|
@@ -6342,6 +6462,9 @@ function _signInWithCredential(auth, credential, bypassAuthState) {
|
|
|
6342
6462
|
* @remarks
|
|
6343
6463
|
* An {@link AuthProvider} can be used to generate the credential.
|
|
6344
6464
|
*
|
|
6465
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6466
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6467
|
+
*
|
|
6345
6468
|
* @param auth - The {@link Auth} instance.
|
|
6346
6469
|
* @param credential - The auth credential.
|
|
6347
6470
|
*
|
|
@@ -6388,6 +6511,9 @@ function linkWithCredential(user, credential) {
|
|
|
6388
6511
|
* attempts. This method can be used to recover from a `CREDENTIAL_TOO_OLD_LOGIN_AGAIN` error
|
|
6389
6512
|
* or a `TOKEN_EXPIRED` error.
|
|
6390
6513
|
*
|
|
6514
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
6515
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
6516
|
+
*
|
|
6391
6517
|
* @param user - The user.
|
|
6392
6518
|
* @param credential - The auth credential.
|
|
6393
6519
|
*
|
|
@@ -6452,6 +6578,9 @@ function signInWithCustomToken$1(auth, request) {
|
|
|
6452
6578
|
*
|
|
6453
6579
|
* Fails with an error if the token is invalid, expired, or not accepted by the Firebase Auth service.
|
|
6454
6580
|
*
|
|
6581
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
6582
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6583
|
+
*
|
|
6455
6584
|
* @param auth - The {@link Auth} instance.
|
|
6456
6585
|
* @param customToken - The custom token to sign in with.
|
|
6457
6586
|
*
|
|
@@ -6463,6 +6592,9 @@ function signInWithCustomToken(auth, customToken) {
|
|
|
6463
6592
|
return __generator(this, function (_a) {
|
|
6464
6593
|
switch (_a.label) {
|
|
6465
6594
|
case 0:
|
|
6595
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
6596
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6597
|
+
}
|
|
6466
6598
|
authInternal = _castAuth(auth);
|
|
6467
6599
|
return [4 /*yield*/, signInWithCustomToken$1(authInternal, {
|
|
6468
6600
|
token: customToken,
|
|
@@ -6819,6 +6951,9 @@ function verifyPasswordResetCode(auth, code) {
|
|
|
6819
6951
|
*
|
|
6820
6952
|
* User account creation can fail if the account already exists or the password is invalid.
|
|
6821
6953
|
*
|
|
6954
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
6955
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
6956
|
+
*
|
|
6822
6957
|
* Note: The email address acts as a unique identifier for the user and enables an email-based
|
|
6823
6958
|
* password reset. This function will create a new user account and set the initial user password.
|
|
6824
6959
|
*
|
|
@@ -6834,6 +6969,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6834
6969
|
return __generator(this, function (_a) {
|
|
6835
6970
|
switch (_a.label) {
|
|
6836
6971
|
case 0:
|
|
6972
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
6973
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
6974
|
+
}
|
|
6837
6975
|
authInternal = _castAuth(auth);
|
|
6838
6976
|
request = {
|
|
6839
6977
|
returnSecureToken: true,
|
|
@@ -6869,10 +7007,14 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6869
7007
|
* When [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled,
|
|
6870
7008
|
* this method fails with "auth/invalid-credential" in case of an invalid email/password.
|
|
6871
7009
|
*
|
|
7010
|
+
* This method is not supported on {@link Auth} instances created with a
|
|
7011
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7012
|
+
*
|
|
6872
7013
|
* Note: The user's password is NOT the password used to access the user's email account. The
|
|
6873
7014
|
* email address serves as a unique identifier for the user, and the password is used to access
|
|
6874
7015
|
* the user's account in your Firebase project. See also: {@link createUserWithEmailAndPassword}.
|
|
6875
7016
|
*
|
|
7017
|
+
*
|
|
6876
7018
|
* @param auth - The {@link Auth} instance.
|
|
6877
7019
|
* @param email - The users email address.
|
|
6878
7020
|
* @param password - The users password.
|
|
@@ -6881,6 +7023,9 @@ function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
6881
7023
|
*/
|
|
6882
7024
|
function signInWithEmailAndPassword(auth, email, password) {
|
|
6883
7025
|
var _this = this;
|
|
7026
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
7027
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth));
|
|
7028
|
+
}
|
|
6884
7029
|
return signInWithCredential(getModularInstance(auth), EmailAuthProvider.credential(email, password)).catch(function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
6885
7030
|
return __generator(this, function (_a) {
|
|
6886
7031
|
if (error.code === "auth/".concat("password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */)) {
|
|
@@ -6992,6 +7137,9 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
6992
7137
|
*
|
|
6993
7138
|
* Fails with an error if the email address is invalid or OTP in email link expires.
|
|
6994
7139
|
*
|
|
7140
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7141
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7142
|
+
*
|
|
6995
7143
|
* Note: Confirm the link is a sign-in email link before calling this method firebase.auth.Auth.isSignInWithEmailLink.
|
|
6996
7144
|
*
|
|
6997
7145
|
* @example
|
|
@@ -7015,6 +7163,7 @@ function isSignInWithEmailLink(auth, emailLink) {
|
|
|
7015
7163
|
* }
|
|
7016
7164
|
* ```
|
|
7017
7165
|
*
|
|
7166
|
+
*
|
|
7018
7167
|
* @param auth - The {@link Auth} instance.
|
|
7019
7168
|
* @param email - The user's email address.
|
|
7020
7169
|
* @param emailLink - The link sent to the user's email address.
|
|
@@ -7025,6 +7174,9 @@ function signInWithEmailLink(auth, email, emailLink) {
|
|
|
7025
7174
|
return __awaiter(this, void 0, void 0, function () {
|
|
7026
7175
|
var authModular, credential;
|
|
7027
7176
|
return __generator(this, function (_a) {
|
|
7177
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
7178
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
7179
|
+
}
|
|
7028
7180
|
authModular = getModularInstance(auth);
|
|
7029
7181
|
credential = EmailAuthProvider.credentialWithLink(email, emailLink || _getCurrentUrl());
|
|
7030
7182
|
// Check if the tenant ID in the email link matches the tenant ID on Auth
|
|
@@ -7338,6 +7490,9 @@ function updateProfile(user, _a) {
|
|
|
7338
7490
|
* An email will be sent to the original email address (if it was set) that allows to revoke the
|
|
7339
7491
|
* email address change, in order to protect them from account hijacking.
|
|
7340
7492
|
*
|
|
7493
|
+
* This method is not supported on any {@link User} signed in by {@link Auth} instances
|
|
7494
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
7495
|
+
*
|
|
7341
7496
|
* Important: this is a security sensitive operation that requires the user to have recently signed
|
|
7342
7497
|
* in. If this requirement isn't met, ask the user to authenticate again and then call
|
|
7343
7498
|
* {@link reauthenticateWithCredential}.
|
|
@@ -7351,7 +7506,11 @@ function updateProfile(user, _a) {
|
|
|
7351
7506
|
* @public
|
|
7352
7507
|
*/
|
|
7353
7508
|
function updateEmail(user, newEmail) {
|
|
7354
|
-
|
|
7509
|
+
var userInternal = getModularInstance(user);
|
|
7510
|
+
if (_isFirebaseServerApp(userInternal.auth.app)) {
|
|
7511
|
+
return Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth));
|
|
7512
|
+
}
|
|
7513
|
+
return updateEmailOrPassword(userInternal, newEmail, null);
|
|
7355
7514
|
}
|
|
7356
7515
|
/**
|
|
7357
7516
|
* Updates the user's password.
|
|
@@ -7556,7 +7715,8 @@ function getAdditionalUserInfo(userCredential) {
|
|
|
7556
7715
|
* remembered or not. It also makes it easier to never persist the `Auth` state for applications
|
|
7557
7716
|
* that are shared by other users or have sensitive data.
|
|
7558
7717
|
*
|
|
7559
|
-
* This method does not work in a Node.js environment
|
|
7718
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
7719
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7560
7720
|
*
|
|
7561
7721
|
* @example
|
|
7562
7722
|
* ```javascript
|
|
@@ -7707,6 +7867,9 @@ function useDeviceLanguage(auth) {
|
|
|
7707
7867
|
* The operation fails with an error if the user to be updated belongs to a different Firebase
|
|
7708
7868
|
* project.
|
|
7709
7869
|
*
|
|
7870
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7871
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7872
|
+
*
|
|
7710
7873
|
* @param auth - The {@link Auth} instance.
|
|
7711
7874
|
* @param user - The new {@link User}.
|
|
7712
7875
|
*
|
|
@@ -7718,6 +7881,10 @@ function updateCurrentUser(auth, user) {
|
|
|
7718
7881
|
/**
|
|
7719
7882
|
* Signs out the current user.
|
|
7720
7883
|
*
|
|
7884
|
+
* @remarks
|
|
7885
|
+
* This method is not supported by {@link Auth} instances created with a
|
|
7886
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
7887
|
+
*
|
|
7721
7888
|
* @param auth - The {@link Auth} instance.
|
|
7722
7889
|
*
|
|
7723
7890
|
* @public
|
|
@@ -9899,7 +10066,8 @@ var ConfirmationResultImpl = /** @class */ (function () {
|
|
|
9899
10066
|
* {@link RecaptchaVerifier} (like React Native), but you need to use a
|
|
9900
10067
|
* third-party {@link ApplicationVerifier} implementation.
|
|
9901
10068
|
*
|
|
9902
|
-
* This method does not work in a Node.js environment
|
|
10069
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
10070
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
9903
10071
|
*
|
|
9904
10072
|
* @example
|
|
9905
10073
|
* ```javascript
|
|
@@ -9922,6 +10090,9 @@ function signInWithPhoneNumber(auth, phoneNumber, appVerifier) {
|
|
|
9922
10090
|
return __generator(this, function (_a) {
|
|
9923
10091
|
switch (_a.label) {
|
|
9924
10092
|
case 0:
|
|
10093
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
10094
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
10095
|
+
}
|
|
9925
10096
|
authInternal = _castAuth(auth);
|
|
9926
10097
|
return [4 /*yield*/, _verifyPhoneNumber(authInternal, phoneNumber, getModularInstance(appVerifier))];
|
|
9927
10098
|
case 1:
|
|
@@ -9971,7 +10142,8 @@ function linkWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
|
9971
10142
|
* @remarks
|
|
9972
10143
|
* Use before operations such as {@link updatePassword} that require tokens from recent sign-in attempts.
|
|
9973
10144
|
*
|
|
9974
|
-
* This method does not work in a Node.js environment
|
|
10145
|
+
* This method does not work in a Node.js environment or on any {@link User} signed in by
|
|
10146
|
+
* {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
|
|
9975
10147
|
*
|
|
9976
10148
|
* @param user - The user.
|
|
9977
10149
|
* @param phoneNumber - The user's phone number in E.164 format (e.g. +16505550101).
|
|
@@ -9986,6 +10158,9 @@ function reauthenticateWithPhoneNumber(user, phoneNumber, appVerifier) {
|
|
|
9986
10158
|
switch (_a.label) {
|
|
9987
10159
|
case 0:
|
|
9988
10160
|
userInternal = getModularInstance(user);
|
|
10161
|
+
if (_isFirebaseServerApp(userInternal.auth.app)) {
|
|
10162
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth))];
|
|
10163
|
+
}
|
|
9989
10164
|
return [4 /*yield*/, _verifyPhoneNumber(userInternal.auth, phoneNumber, getModularInstance(appVerifier))];
|
|
9990
10165
|
case 1:
|
|
9991
10166
|
verificationId = _a.sent();
|
|
@@ -10073,7 +10248,8 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
10073
10248
|
* Updates the user's phone number.
|
|
10074
10249
|
*
|
|
10075
10250
|
* @remarks
|
|
10076
|
-
* This method does not work in a Node.js environment
|
|
10251
|
+
* This method does not work in a Node.js environment or on any {@link User} signed in by
|
|
10252
|
+
* {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
|
|
10077
10253
|
*
|
|
10078
10254
|
* @example
|
|
10079
10255
|
* ```
|
|
@@ -10093,9 +10269,15 @@ function _verifyPhoneNumber(auth, options, verifier) {
|
|
|
10093
10269
|
*/
|
|
10094
10270
|
function updatePhoneNumber(user, credential) {
|
|
10095
10271
|
return __awaiter(this, void 0, void 0, function () {
|
|
10272
|
+
var userInternal;
|
|
10096
10273
|
return __generator(this, function (_a) {
|
|
10097
10274
|
switch (_a.label) {
|
|
10098
|
-
case 0:
|
|
10275
|
+
case 0:
|
|
10276
|
+
userInternal = getModularInstance(user);
|
|
10277
|
+
if (_isFirebaseServerApp(userInternal.auth.app)) {
|
|
10278
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth))];
|
|
10279
|
+
}
|
|
10280
|
+
return [4 /*yield*/, _link$1(userInternal, credential)];
|
|
10099
10281
|
case 1:
|
|
10100
10282
|
_a.sent();
|
|
10101
10283
|
return [2 /*return*/];
|
|
@@ -10530,7 +10712,8 @@ var _POLL_WINDOW_CLOSE_TIMEOUT = new Delay(2000, 10000);
|
|
|
10530
10712
|
* If succeeds, returns the signed in user along with the provider's credential. If sign in was
|
|
10531
10713
|
* unsuccessful, returns an error object containing additional information about the error.
|
|
10532
10714
|
*
|
|
10533
|
-
* This method does not work in a Node.js environment
|
|
10715
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
10716
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
10534
10717
|
*
|
|
10535
10718
|
* @example
|
|
10536
10719
|
* ```javascript
|
|
@@ -10557,6 +10740,9 @@ function signInWithPopup(auth, provider, resolver) {
|
|
|
10557
10740
|
return __awaiter(this, void 0, void 0, function () {
|
|
10558
10741
|
var authInternal, resolverInternal, action;
|
|
10559
10742
|
return __generator(this, function (_a) {
|
|
10743
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
10744
|
+
return [2 /*return*/, Promise.reject(_createError(auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */))];
|
|
10745
|
+
}
|
|
10560
10746
|
authInternal = _castAuth(auth);
|
|
10561
10747
|
_assertInstanceOf(auth, provider, FederatedAuthProvider);
|
|
10562
10748
|
resolverInternal = _withDefaultResolver(authInternal, resolver);
|
|
@@ -10573,7 +10759,8 @@ function signInWithPopup(auth, provider, resolver) {
|
|
|
10573
10759
|
* If the reauthentication is successful, the returned result will contain the user and the
|
|
10574
10760
|
* provider's credential.
|
|
10575
10761
|
*
|
|
10576
|
-
* This method does not work in a Node.js environment
|
|
10762
|
+
* This method does not work in a Node.js environment or on any {@link User} signed in by
|
|
10763
|
+
* {@link Auth} instances created with a {@link @firebase/app#FirebaseServerApp}.
|
|
10577
10764
|
*
|
|
10578
10765
|
* @example
|
|
10579
10766
|
* ```javascript
|
|
@@ -10597,6 +10784,9 @@ function reauthenticateWithPopup(user, provider, resolver) {
|
|
|
10597
10784
|
var userInternal, resolverInternal, action;
|
|
10598
10785
|
return __generator(this, function (_a) {
|
|
10599
10786
|
userInternal = getModularInstance(user);
|
|
10787
|
+
if (_isFirebaseServerApp(userInternal.auth.app)) {
|
|
10788
|
+
return [2 /*return*/, Promise.reject(_createError(userInternal.auth, "operation-not-supported-in-this-environment" /* AuthErrorCode.OPERATION_NOT_SUPPORTED */))];
|
|
10789
|
+
}
|
|
10600
10790
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
10601
10791
|
resolverInternal = _withDefaultResolver(userInternal.auth, resolver);
|
|
10602
10792
|
action = new PopupOperation(userInternal.auth, "reauthViaPopup" /* AuthEventType.REAUTH_VIA_POPUP */, provider, resolverInternal, userInternal);
|
|
@@ -10946,7 +11136,8 @@ function pendingRedirectKey(auth) {
|
|
|
10946
11136
|
* Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
|
|
10947
11137
|
* | best practices} when using {@link signInWithRedirect}.
|
|
10948
11138
|
*
|
|
10949
|
-
* This method does not work in a Node.js environment
|
|
11139
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
11140
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
10950
11141
|
*
|
|
10951
11142
|
* @example
|
|
10952
11143
|
* ```javascript
|
|
@@ -10990,6 +11181,9 @@ function _signInWithRedirect(auth, provider, resolver) {
|
|
|
10990
11181
|
return __generator(this, function (_a) {
|
|
10991
11182
|
switch (_a.label) {
|
|
10992
11183
|
case 0:
|
|
11184
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
11185
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
11186
|
+
}
|
|
10993
11187
|
authInternal = _castAuth(auth);
|
|
10994
11188
|
_assertInstanceOf(auth, provider, FederatedAuthProvider);
|
|
10995
11189
|
// Wait for auth initialization to complete, this will process pending redirects and clear the
|
|
@@ -11017,7 +11211,8 @@ function _signInWithRedirect(auth, provider, resolver) {
|
|
|
11017
11211
|
* Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
|
|
11018
11212
|
* | best practices} when using {@link reauthenticateWithRedirect}.
|
|
11019
11213
|
*
|
|
11020
|
-
* This method does not work in a Node.js environment
|
|
11214
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances
|
|
11215
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
11021
11216
|
*
|
|
11022
11217
|
* @example
|
|
11023
11218
|
* ```javascript
|
|
@@ -11055,6 +11250,9 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
11055
11250
|
case 0:
|
|
11056
11251
|
userInternal = getModularInstance(user);
|
|
11057
11252
|
_assertInstanceOf(userInternal.auth, provider, FederatedAuthProvider);
|
|
11253
|
+
if (_isFirebaseServerApp(userInternal.auth.app)) {
|
|
11254
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(userInternal.auth))];
|
|
11255
|
+
}
|
|
11058
11256
|
// Wait for auth initialization to complete, this will process pending redirects and clear the
|
|
11059
11257
|
// PENDING_REDIRECT_KEY in persistence. This should be completed before starting a new
|
|
11060
11258
|
// redirect and creating a PENDING_REDIRECT_KEY entry.
|
|
@@ -11083,7 +11281,8 @@ function _reauthenticateWithRedirect(user, provider, resolver) {
|
|
|
11083
11281
|
* Follow the {@link https://firebase.google.com/docs/auth/web/redirect-best-practices
|
|
11084
11282
|
* | best practices} when using {@link linkWithRedirect}.
|
|
11085
11283
|
*
|
|
11086
|
-
* This method does not work in a Node.js environment
|
|
11284
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances
|
|
11285
|
+
* created with a {@link @firebase/app#FirebaseServerApp}.
|
|
11087
11286
|
*
|
|
11088
11287
|
* @example
|
|
11089
11288
|
* ```javascript
|
|
@@ -11148,7 +11347,8 @@ function _linkWithRedirect(user, provider, resolver) {
|
|
|
11148
11347
|
* If sign-in succeeded, returns the signed in user. If sign-in was unsuccessful, fails with an
|
|
11149
11348
|
* error. If no redirect operation was called, returns `null`.
|
|
11150
11349
|
*
|
|
11151
|
-
* This method does not work in a Node.js environment
|
|
11350
|
+
* This method does not work in a Node.js environment or with {@link Auth} instances created with a
|
|
11351
|
+
* {@link @firebase/app#FirebaseServerApp}.
|
|
11152
11352
|
*
|
|
11153
11353
|
* @example
|
|
11154
11354
|
* ```javascript
|
|
@@ -11200,6 +11400,9 @@ function _getRedirectResult(auth, resolverExtern, bypassAuthState) {
|
|
|
11200
11400
|
return __generator(this, function (_a) {
|
|
11201
11401
|
switch (_a.label) {
|
|
11202
11402
|
case 0:
|
|
11403
|
+
if (_isFirebaseServerApp(auth.app)) {
|
|
11404
|
+
return [2 /*return*/, Promise.reject(_serverAppCurrentUserOperationNotSupportedError(auth))];
|
|
11405
|
+
}
|
|
11203
11406
|
authInternal = _castAuth(auth);
|
|
11204
11407
|
resolver = _withDefaultResolver(authInternal, resolverExtern);
|
|
11205
11408
|
action = new RedirectAction(authInternal, resolver, bypassAuthState);
|
|
@@ -12271,7 +12474,7 @@ function _isEmptyString(input) {
|
|
|
12271
12474
|
}
|
|
12272
12475
|
|
|
12273
12476
|
var name = "@firebase/auth";
|
|
12274
|
-
var version = "1.
|
|
12477
|
+
var version = "1.7.0-canary.42fcdfe4c";
|
|
12275
12478
|
|
|
12276
12479
|
/**
|
|
12277
12480
|
* @license
|
|
@@ -12510,14 +12713,19 @@ function getAuth(app) {
|
|
|
12510
12713
|
]
|
|
12511
12714
|
});
|
|
12512
12715
|
var authTokenSyncPath = getExperimentalSetting('authTokenSyncURL');
|
|
12513
|
-
//
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12716
|
+
// Only do the Cookie exchange in a secure context
|
|
12717
|
+
if (authTokenSyncPath &&
|
|
12718
|
+
typeof isSecureContext === 'boolean' &&
|
|
12719
|
+
isSecureContext) {
|
|
12720
|
+
// Don't allow urls (XSS possibility), only paths on the same domain
|
|
12721
|
+
var authTokenSyncUrl = new URL(authTokenSyncPath, location.origin);
|
|
12722
|
+
if (location.origin === authTokenSyncUrl.origin) {
|
|
12723
|
+
var mintCookie_1 = mintCookieFactory(authTokenSyncUrl.toString());
|
|
12724
|
+
beforeAuthStateChanged(auth, mintCookie_1, function () {
|
|
12725
|
+
return mintCookie_1(auth.currentUser);
|
|
12726
|
+
});
|
|
12727
|
+
onIdTokenChanged(auth, function (user) { return mintCookie_1(user); });
|
|
12728
|
+
}
|
|
12521
12729
|
}
|
|
12522
12730
|
var authEmulatorHost = getDefaultEmulatorHost('auth');
|
|
12523
12731
|
if (authEmulatorHost) {
|
|
@@ -12553,4 +12761,4 @@ _setExternalJSProvider({
|
|
|
12553
12761
|
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
12554
12762
|
|
|
12555
12763
|
export { TwitterAuthProvider as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, revokeAccessToken as D, deleteUser as E, FactorId as F, debugErrorMap as G, prodErrorMap as H, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as I, initializeAuth as J, connectAuthEmulator as K, AuthCredential as L, EmailAuthCredential as M, OAuthCredential as N, OperationType as O, PhoneAuthProvider as P, PhoneAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, inMemoryPersistence as U, EmailAuthProvider as V, FacebookAuthProvider as W, GoogleAuthProvider as X, GithubAuthProvider as Y, OAuthProvider as Z, SAMLAuthProvider as _, browserSessionPersistence as a, signInAnonymously as a0, signInWithCredential as a1, linkWithCredential as a2, reauthenticateWithCredential as a3, signInWithCustomToken as a4, sendPasswordResetEmail as a5, confirmPasswordReset as a6, applyActionCode as a7, checkActionCode as a8, verifyPasswordResetCode as a9, _isIOS7Or8 as aA, _assert as aB, _createError as aC, AuthEventManager as aD, _getInstance as aE, _persistenceKeyName as aF, _clearRedirectOutcomes as aG, _getRedirectResult as aH, _overrideRedirectResult as aI, _castAuth as aJ, UserImpl as aK, AuthImpl as aL, _getClientVersion as aM, _generateEventId as aN, AuthPopup as aO, FetchProvider as aP, SAMLAuthCredential as aQ, createUserWithEmailAndPassword as aa, signInWithEmailAndPassword as ab, sendSignInLinkToEmail as ac, isSignInWithEmailLink as ad, signInWithEmailLink as ae, fetchSignInMethodsForEmail as af, sendEmailVerification as ag, verifyBeforeUpdateEmail as ah, ActionCodeURL as ai, parseActionCodeURL as aj, updateProfile as ak, updateEmail as al, updatePassword as am, getIdToken as an, getIdTokenResult as ao, unlink as ap, getAdditionalUserInfo as aq, reload as ar, getMultiFactorResolver as as, multiFactor as at, _isIOS as au, _isAndroid as av, _fail as aw, _getRedirectUrl as ax, debugAssert as ay, _getProjectConfig as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
|
|
12556
|
-
//# sourceMappingURL=index-
|
|
12764
|
+
//# sourceMappingURL=index-dcfb76ea.js.map
|