@firebase/auth 1.9.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-public.d.ts +28 -1
- package/dist/auth.d.ts +40 -2
- package/dist/browser-cjs/{index-018c7ebd.js → index-eddc1dc3.js} +211 -15
- package/dist/browser-cjs/index-eddc1dc3.js.map +1 -0
- package/dist/browser-cjs/index.d.ts +2 -1
- package/dist/browser-cjs/index.js +2 -1
- package/dist/browser-cjs/index.js.map +1 -1
- package/dist/browser-cjs/internal.js +2 -1
- package/dist/browser-cjs/internal.js.map +1 -1
- package/dist/browser-cjs/src/api/index.d.ts +1 -1
- package/dist/browser-cjs/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/browser-cjs/src/core/persistence/index.d.ts +2 -1
- package/dist/browser-cjs/src/model/auth.d.ts +4 -1
- package/dist/browser-cjs/src/model/public_types.d.ts +2 -1
- package/dist/browser-cjs/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/browser-cjs/src/platform_node/index.d.ts +1 -0
- package/dist/cordova/auth-cordova-public.d.ts +26 -1
- package/dist/cordova/auth-cordova.d.ts +29 -2
- package/dist/cordova/index.d.ts +2 -1
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +147 -3
- package/dist/cordova/internal.js.map +1 -1
- package/dist/cordova/{popup_redirect-e795474a.js → popup_redirect-5323ec00.js} +66 -15
- package/dist/cordova/popup_redirect-5323ec00.js.map +1 -0
- package/dist/cordova/src/api/index.d.ts +1 -1
- package/dist/cordova/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/cordova/src/core/persistence/index.d.ts +2 -1
- package/dist/cordova/src/model/auth.d.ts +4 -1
- package/dist/cordova/src/model/public_types.d.ts +2 -1
- package/dist/cordova/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/cordova/src/platform_node/index.d.ts +1 -0
- package/dist/esm2017/{index-e84cf44d.js → index-c92d61ad.js} +211 -16
- package/dist/esm2017/index-c92d61ad.js.map +1 -0
- package/dist/esm2017/index.d.ts +2 -1
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/api/index.d.ts +1 -1
- package/dist/esm2017/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/esm2017/src/core/persistence/index.d.ts +2 -1
- package/dist/esm2017/src/model/auth.d.ts +4 -1
- package/dist/esm2017/src/model/public_types.d.ts +2 -1
- package/dist/esm2017/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/esm2017/src/platform_node/index.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.webworker.js +65 -14
- package/dist/index.webworker.js.map +1 -1
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.js +2 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/internal.js +2 -1
- package/dist/node/internal.js.map +1 -1
- package/dist/node/src/api/index.d.ts +1 -1
- package/dist/node/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/node/src/core/persistence/index.d.ts +2 -1
- package/dist/node/src/model/auth.d.ts +4 -1
- package/dist/node/src/model/public_types.d.ts +2 -1
- package/dist/node/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/node/src/platform_node/index.d.ts +1 -0
- package/dist/node/{totp-06fa6909.js → totp-af329771.js} +68 -15
- package/dist/node/totp-af329771.js.map +1 -0
- package/dist/node-esm/index.d.ts +2 -1
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/internal.js.map +1 -1
- package/dist/node-esm/src/api/index.d.ts +1 -1
- package/dist/node-esm/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/node-esm/src/core/persistence/index.d.ts +2 -1
- package/dist/node-esm/src/model/auth.d.ts +4 -1
- package/dist/node-esm/src/model/public_types.d.ts +2 -1
- package/dist/node-esm/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/node-esm/src/platform_node/index.d.ts +1 -0
- package/dist/node-esm/{totp-d5ff2369.js → totp-7829abf2.js} +68 -16
- package/dist/node-esm/totp-7829abf2.js.map +1 -0
- package/dist/rn/{index-ee081591.js → index-e8d5e0fb.js} +66 -15
- package/dist/rn/index-e8d5e0fb.js.map +1 -0
- package/dist/rn/index.d.ts +2 -1
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +146 -1
- package/dist/rn/internal.js.map +1 -1
- package/dist/rn/src/api/index.d.ts +1 -1
- package/dist/rn/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/rn/src/core/persistence/index.d.ts +2 -1
- package/dist/rn/src/model/auth.d.ts +4 -1
- package/dist/rn/src/model/public_types.d.ts +2 -1
- package/dist/rn/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/rn/src/platform_node/index.d.ts +1 -0
- package/dist/src/api/index.d.ts +1 -1
- package/dist/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/src/core/persistence/index.d.ts +2 -1
- package/dist/src/model/auth.d.ts +4 -1
- package/dist/src/model/public_types.d.ts +2 -1
- package/dist/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/src/platform_node/index.d.ts +1 -0
- package/dist/web-extension-cjs/index.d.ts +2 -1
- package/dist/web-extension-cjs/index.js +1 -1
- package/dist/web-extension-cjs/internal.js +146 -1
- package/dist/web-extension-cjs/internal.js.map +1 -1
- package/dist/web-extension-cjs/{register-c2c7670d.js → register-b64ddc5e.js} +66 -15
- package/dist/web-extension-cjs/register-b64ddc5e.js.map +1 -0
- package/dist/web-extension-cjs/src/api/index.d.ts +1 -1
- package/dist/web-extension-cjs/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/web-extension-cjs/src/core/persistence/index.d.ts +2 -1
- package/dist/web-extension-cjs/src/model/auth.d.ts +4 -1
- package/dist/web-extension-cjs/src/model/public_types.d.ts +2 -1
- package/dist/web-extension-cjs/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/web-extension-cjs/src/platform_node/index.d.ts +1 -0
- package/dist/web-extension-esm2017/auth-web-extension-public.d.ts +26 -1
- package/dist/web-extension-esm2017/auth-web-extension.d.ts +29 -2
- package/dist/web-extension-esm2017/index.d.ts +2 -1
- package/dist/web-extension-esm2017/index.js +2 -2
- package/dist/web-extension-esm2017/internal.js +147 -3
- package/dist/web-extension-esm2017/internal.js.map +1 -1
- package/dist/web-extension-esm2017/{register-31c228e4.js → register-00522d81.js} +66 -15
- package/dist/web-extension-esm2017/register-00522d81.js.map +1 -0
- package/dist/web-extension-esm2017/src/api/index.d.ts +1 -1
- package/dist/web-extension-esm2017/src/core/auth/auth_impl.d.ts +4 -1
- package/dist/web-extension-esm2017/src/core/persistence/index.d.ts +2 -1
- package/dist/web-extension-esm2017/src/model/auth.d.ts +4 -1
- package/dist/web-extension-esm2017/src/model/public_types.d.ts +2 -1
- package/dist/web-extension-esm2017/src/platform_browser/persistence/cookie_storage.d.ts +40 -0
- package/dist/web-extension-esm2017/src/platform_node/index.d.ts +1 -0
- package/package.json +3 -2
- package/dist/browser-cjs/index-018c7ebd.js.map +0 -1
- package/dist/cordova/popup_redirect-e795474a.js.map +0 -1
- package/dist/esm2017/index-e84cf44d.js.map +0 -1
- package/dist/node/totp-06fa6909.js.map +0 -1
- package/dist/node-esm/totp-d5ff2369.js.map +0 -1
- package/dist/rn/index-ee081591.js.map +0 -1
- package/dist/web-extension-cjs/register-c2c7670d.js.map +0 -1
- package/dist/web-extension-esm2017/register-31c228e4.js.map +0 -1
|
@@ -91,7 +91,7 @@ export declare function _addTidIfNecessary<T extends {
|
|
|
91
91
|
export declare function _performApiRequest<T, V>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
|
|
92
92
|
export declare function _performFetchWithErrorHandling<V>(auth: Auth, customErrorMap: Partial<ServerErrorMap<ServerError>>, fetchFn: () => Promise<Response>): Promise<V>;
|
|
93
93
|
export declare function _performSignInRequest<T, V extends IdTokenResponse>(auth: Auth, method: HttpMethod, path: Endpoint, request?: T, customErrorMap?: Partial<ServerErrorMap<ServerError>>): Promise<V>;
|
|
94
|
-
export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): string
|
|
94
|
+
export declare function _getFinalTarget(auth: Auth, host: string, path: string, query: string): Promise<string>;
|
|
95
95
|
export declare function _parseEnforcementState(enforcementStateStr: string): EnforcementState;
|
|
96
96
|
interface PotentialResponse extends IdTokenResponse {
|
|
97
97
|
email?: string;
|
|
@@ -57,6 +57,8 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
|
57
57
|
_tenantRecaptchaConfigs: Record<string, RecaptchaConfig>;
|
|
58
58
|
_projectPasswordPolicy: PasswordPolicyInternal | null;
|
|
59
59
|
_tenantPasswordPolicies: Record<string, PasswordPolicyInternal>;
|
|
60
|
+
_resolvePersistenceManagerAvailable: ((value: void | PromiseLike<void>) => void) | undefined;
|
|
61
|
+
_persistenceManagerAvailable: Promise<void>;
|
|
60
62
|
readonly name: string;
|
|
61
63
|
private lastNotifiedUid;
|
|
62
64
|
languageCode: string | null;
|
|
@@ -82,7 +84,8 @@ export declare class AuthImpl implements AuthInternal, _FirebaseService {
|
|
|
82
84
|
validatePassword(password: string): Promise<PasswordValidationStatus>;
|
|
83
85
|
_getPasswordPolicyInternal(): PasswordPolicyInternal | null;
|
|
84
86
|
_updatePasswordPolicy(): Promise<void>;
|
|
85
|
-
|
|
87
|
+
_getPersistenceType(): string;
|
|
88
|
+
_getPersistence(): PersistenceInternal;
|
|
86
89
|
_updateErrorMap(errorMap: AuthErrorMap): void;
|
|
87
90
|
onAuthStateChanged(nextOrObserver: NextOrObserver<User>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
|
|
88
91
|
beforeAuthStateChanged(callback: (user: User | null) => void | Promise<void>, onAbort?: () => void): Unsubscribe;
|
|
@@ -18,7 +18,8 @@ import { Persistence } from '../../model/public_types';
|
|
|
18
18
|
export declare const enum PersistenceType {
|
|
19
19
|
SESSION = "SESSION",
|
|
20
20
|
LOCAL = "LOCAL",
|
|
21
|
-
NONE = "NONE"
|
|
21
|
+
NONE = "NONE",
|
|
22
|
+
COOKIE = "COOKIE"
|
|
22
23
|
}
|
|
23
24
|
export type PersistedBlob = Record<string, unknown>;
|
|
24
25
|
export interface Instantiator<T> {
|
|
@@ -22,6 +22,7 @@ import { UserInternal } from './user';
|
|
|
22
22
|
import { ClientPlatform } from '../core/util/version';
|
|
23
23
|
import { RecaptchaConfig } from '../platform_browser/recaptcha/recaptcha';
|
|
24
24
|
import { PasswordPolicyInternal } from './password_policy';
|
|
25
|
+
import { PersistenceInternal } from '../core/persistence';
|
|
25
26
|
export type AppName = string;
|
|
26
27
|
export type ApiKey = string;
|
|
27
28
|
export type AuthDomain = string;
|
|
@@ -56,6 +57,7 @@ export interface AuthInternal extends Auth {
|
|
|
56
57
|
_canInitEmulator: boolean;
|
|
57
58
|
_isInitialized: boolean;
|
|
58
59
|
_initializationPromise: Promise<void> | null;
|
|
60
|
+
_persistenceManagerAvailable: Promise<void>;
|
|
59
61
|
_updateCurrentUser(user: UserInternal | null): Promise<void>;
|
|
60
62
|
_onStorageEvent(): void;
|
|
61
63
|
_notifyListenersIfCurrent(user: UserInternal): void;
|
|
@@ -66,7 +68,8 @@ export interface AuthInternal extends Auth {
|
|
|
66
68
|
_key(): string;
|
|
67
69
|
_startProactiveRefresh(): void;
|
|
68
70
|
_stopProactiveRefresh(): void;
|
|
69
|
-
|
|
71
|
+
_getPersistenceType(): string;
|
|
72
|
+
_getPersistence(): PersistenceInternal;
|
|
70
73
|
_getRecaptchaConfig(): RecaptchaConfig | null;
|
|
71
74
|
_getPasswordPolicyInternal(): PasswordPolicyInternal | null;
|
|
72
75
|
_updatePasswordPolicy(): Promise<void>;
|
|
@@ -305,8 +305,9 @@ export interface Persistence {
|
|
|
305
305
|
* - 'SESSION' is used for temporary persistence such as `sessionStorage`.
|
|
306
306
|
* - 'LOCAL' is used for long term persistence such as `localStorage` or `IndexedDB`.
|
|
307
307
|
* - 'NONE' is used for in-memory, or no persistence.
|
|
308
|
+
* - 'COOKIE' is used for cookie persistence, useful for server-side rendering.
|
|
308
309
|
*/
|
|
309
|
-
readonly type: 'SESSION' | 'LOCAL' | 'NONE';
|
|
310
|
+
readonly type: 'SESSION' | 'LOCAL' | 'NONE' | 'COOKIE';
|
|
310
311
|
}
|
|
311
312
|
/**
|
|
312
313
|
* Interface representing ID token result obtained from {@link User.getIdTokenResult}.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Persistence } from '../../model/public_types';
|
|
18
|
+
import { PersistenceInternal, PersistenceType, PersistenceValue, StorageEventListener } from '../../core/persistence';
|
|
19
|
+
export declare class CookiePersistence implements PersistenceInternal {
|
|
20
|
+
static type: 'COOKIE';
|
|
21
|
+
readonly type = PersistenceType.COOKIE;
|
|
22
|
+
listenerUnsubscribes: Map<StorageEventListener, () => void>;
|
|
23
|
+
_getFinalTarget(originalUrl: string): URL | string;
|
|
24
|
+
_isAvailable(): Promise<boolean>;
|
|
25
|
+
_set(_key: string, _value: PersistenceValue): Promise<void>;
|
|
26
|
+
_get<T extends PersistenceValue>(key: string): Promise<T | null>;
|
|
27
|
+
_remove(key: string): Promise<void>;
|
|
28
|
+
_addListener(key: string, listener: StorageEventListener): void;
|
|
29
|
+
_removeListener(_key: string, listener: StorageEventListener): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* An implementation of {@link Persistence} of type `COOKIE`, for use on the client side in
|
|
33
|
+
* applications leveraging hybrid rendering and middleware.
|
|
34
|
+
*
|
|
35
|
+
* @remarks This persistence method requires companion middleware to function, such as that provided
|
|
36
|
+
* by {@link https://firebaseopensource.com/projects/firebaseextended/reactfire/ | ReactFire} for
|
|
37
|
+
* NextJS.
|
|
38
|
+
* @beta
|
|
39
|
+
*/
|
|
40
|
+
export declare const browserCookiePersistence: Persistence;
|
|
@@ -28,6 +28,7 @@ declare class FailClass {
|
|
|
28
28
|
}
|
|
29
29
|
export declare const browserLocalPersistence: import("../model/public_types").Persistence;
|
|
30
30
|
export declare const browserSessionPersistence: import("../model/public_types").Persistence;
|
|
31
|
+
export declare const browserCookiePersistence: import("../model/public_types").Persistence;
|
|
31
32
|
export declare const indexedDBLocalPersistence: import("../model/public_types").Persistence;
|
|
32
33
|
export declare const browserPopupRedirectResolver: import("@firebase/app").FirebaseError;
|
|
33
34
|
export declare const PhoneAuthProvider: typeof FailClass;
|
|
@@ -861,6 +861,14 @@ const SERVER_ERROR_MAP = {
|
|
|
861
861
|
* See the License for the specific language governing permissions and
|
|
862
862
|
* limitations under the License.
|
|
863
863
|
*/
|
|
864
|
+
const CookieAuthProxiedEndpoints = [
|
|
865
|
+
"/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */,
|
|
866
|
+
"/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */,
|
|
867
|
+
"/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */,
|
|
868
|
+
"/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */,
|
|
869
|
+
"/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */,
|
|
870
|
+
"/v1/token" /* Endpoint.TOKEN */
|
|
871
|
+
];
|
|
864
872
|
const DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);
|
|
865
873
|
function _addTidIfNecessary(auth, request) {
|
|
866
874
|
if (auth.tenantId && !request.tenantId) {
|
|
@@ -897,7 +905,7 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
897
905
|
if (!util.isCloudflareWorker()) {
|
|
898
906
|
fetchArgs.referrerPolicy = 'no-referrer';
|
|
899
907
|
}
|
|
900
|
-
return FetchProvider.fetch()(_getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);
|
|
908
|
+
return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);
|
|
901
909
|
});
|
|
902
910
|
}
|
|
903
911
|
async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
@@ -962,12 +970,25 @@ async function _performSignInRequest(auth, method, path, request, customErrorMap
|
|
|
962
970
|
}
|
|
963
971
|
return serverResponse;
|
|
964
972
|
}
|
|
965
|
-
function _getFinalTarget(auth, host, path, query) {
|
|
973
|
+
async function _getFinalTarget(auth, host, path, query) {
|
|
966
974
|
const base = `${host}${path}?${query}`;
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
975
|
+
const authInternal = auth;
|
|
976
|
+
const finalTarget = authInternal.config.emulator
|
|
977
|
+
? _emulatorUrl(auth.config, base)
|
|
978
|
+
: `${auth.config.apiScheme}://${base}`;
|
|
979
|
+
// Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,
|
|
980
|
+
// saving the idToken and refreshToken into cookies, and then redacting the refreshToken
|
|
981
|
+
// from the response
|
|
982
|
+
if (CookieAuthProxiedEndpoints.includes(path)) {
|
|
983
|
+
// Persistence manager is async, we need to await it. We can't just wait for auth initialized
|
|
984
|
+
// here since auth initialization calls this function.
|
|
985
|
+
await authInternal._persistenceManagerAvailable;
|
|
986
|
+
if (authInternal._getPersistenceType() === "COOKIE" /* PersistenceType.COOKIE */) {
|
|
987
|
+
const cookiePersistence = authInternal._getPersistence();
|
|
988
|
+
return cookiePersistence._getFinalTarget(finalTarget).toString();
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return finalTarget;
|
|
971
992
|
}
|
|
972
993
|
function _parseEnforcementState(enforcementStateStr) {
|
|
973
994
|
switch (enforcementStateStr) {
|
|
@@ -1536,7 +1557,7 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1536
1557
|
'refresh_token': refreshToken
|
|
1537
1558
|
}).slice(1);
|
|
1538
1559
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1539
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1560
|
+
const url = await _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1540
1561
|
const headers = await auth._getAdditionalHeaders();
|
|
1541
1562
|
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1542
1563
|
return FetchProvider.fetch()(url, {
|
|
@@ -2027,7 +2048,17 @@ class PersistenceUserManager {
|
|
|
2027
2048
|
}
|
|
2028
2049
|
async getCurrentUser() {
|
|
2029
2050
|
const blob = await this.persistence._get(this.fullUserKey);
|
|
2030
|
-
|
|
2051
|
+
if (!blob) {
|
|
2052
|
+
return null;
|
|
2053
|
+
}
|
|
2054
|
+
if (typeof blob === 'string') {
|
|
2055
|
+
const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined);
|
|
2056
|
+
if (!response) {
|
|
2057
|
+
return null;
|
|
2058
|
+
}
|
|
2059
|
+
return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);
|
|
2060
|
+
}
|
|
2061
|
+
return UserImpl._fromJSON(this.auth, blob);
|
|
2031
2062
|
}
|
|
2032
2063
|
removeCurrentUser() {
|
|
2033
2064
|
return this.persistence._remove(this.fullUserKey);
|
|
@@ -2074,7 +2105,19 @@ class PersistenceUserManager {
|
|
|
2074
2105
|
try {
|
|
2075
2106
|
const blob = await persistence._get(key);
|
|
2076
2107
|
if (blob) {
|
|
2077
|
-
|
|
2108
|
+
let user;
|
|
2109
|
+
if (typeof blob === 'string') {
|
|
2110
|
+
const response = await getAccountInfo(auth, {
|
|
2111
|
+
idToken: blob
|
|
2112
|
+
}).catch(() => undefined);
|
|
2113
|
+
if (!response) {
|
|
2114
|
+
break;
|
|
2115
|
+
}
|
|
2116
|
+
user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob);
|
|
2117
|
+
}
|
|
2118
|
+
else {
|
|
2119
|
+
user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
|
|
2120
|
+
}
|
|
2078
2121
|
if (persistence !== selectedPersistence) {
|
|
2079
2122
|
userToMigrate = user;
|
|
2080
2123
|
}
|
|
@@ -2568,6 +2611,7 @@ class AuthImpl {
|
|
|
2568
2611
|
this._tenantRecaptchaConfigs = {};
|
|
2569
2612
|
this._projectPasswordPolicy = null;
|
|
2570
2613
|
this._tenantPasswordPolicies = {};
|
|
2614
|
+
this._resolvePersistenceManagerAvailable = undefined;
|
|
2571
2615
|
// Tracks the last notified UID for state change listeners to prevent
|
|
2572
2616
|
// repeated calls to the callbacks. Undefined means it's never been
|
|
2573
2617
|
// called, whereas null means it's been called with a signed out user
|
|
@@ -2578,6 +2622,9 @@ class AuthImpl {
|
|
|
2578
2622
|
this.frameworks = [];
|
|
2579
2623
|
this.name = app.name;
|
|
2580
2624
|
this.clientVersion = config.sdkClientVersion;
|
|
2625
|
+
// TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs
|
|
2626
|
+
// persistenceMananger to be available. see _getFinalTarget for more context
|
|
2627
|
+
this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve));
|
|
2581
2628
|
}
|
|
2582
2629
|
_initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {
|
|
2583
2630
|
if (popupRedirectResolver) {
|
|
@@ -2586,17 +2633,18 @@ class AuthImpl {
|
|
|
2586
2633
|
// Have to check for app deletion throughout initialization (after each
|
|
2587
2634
|
// promise resolution)
|
|
2588
2635
|
this._initializationPromise = this.queue(async () => {
|
|
2589
|
-
var _a, _b;
|
|
2636
|
+
var _a, _b, _c;
|
|
2590
2637
|
if (this._deleted) {
|
|
2591
2638
|
return;
|
|
2592
2639
|
}
|
|
2593
2640
|
this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
|
|
2641
|
+
(_a = this._resolvePersistenceManagerAvailable) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2594
2642
|
if (this._deleted) {
|
|
2595
2643
|
return;
|
|
2596
2644
|
}
|
|
2597
2645
|
// Initialize the resolver early if necessary (only applicable to web:
|
|
2598
2646
|
// this will cause the iframe to load immediately in certain cases)
|
|
2599
|
-
if ((
|
|
2647
|
+
if ((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively) {
|
|
2600
2648
|
// If this fails, don't halt auth loading
|
|
2601
2649
|
try {
|
|
2602
2650
|
await this._popupRedirectResolver._initialize(this);
|
|
@@ -2606,7 +2654,7 @@ class AuthImpl {
|
|
|
2606
2654
|
}
|
|
2607
2655
|
}
|
|
2608
2656
|
await this.initializeCurrentUser(popupRedirectResolver);
|
|
2609
|
-
this.lastNotifiedUid = ((
|
|
2657
|
+
this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;
|
|
2610
2658
|
if (this._deleted) {
|
|
2611
2659
|
return;
|
|
2612
2660
|
}
|
|
@@ -2860,9 +2908,12 @@ class AuthImpl {
|
|
|
2860
2908
|
this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;
|
|
2861
2909
|
}
|
|
2862
2910
|
}
|
|
2863
|
-
|
|
2911
|
+
_getPersistenceType() {
|
|
2864
2912
|
return this.assertedPersistence.persistence.type;
|
|
2865
2913
|
}
|
|
2914
|
+
_getPersistence() {
|
|
2915
|
+
return this.assertedPersistence.persistence;
|
|
2916
|
+
}
|
|
2866
2917
|
_updateErrorMap(errorMap) {
|
|
2867
2918
|
this._errorFactory = new util.ErrorFactory('auth', 'Firebase', errorMap());
|
|
2868
2919
|
}
|
|
@@ -7081,7 +7132,7 @@ function multiFactor(user) {
|
|
|
7081
7132
|
}
|
|
7082
7133
|
|
|
7083
7134
|
var name = "@firebase/auth";
|
|
7084
|
-
var version = "1.
|
|
7135
|
+
var version = "1.10.0";
|
|
7085
7136
|
|
|
7086
7137
|
/**
|
|
7087
7138
|
* @license
|
|
@@ -7283,6 +7334,7 @@ class FailClass {
|
|
|
7283
7334
|
}
|
|
7284
7335
|
const browserLocalPersistence = inMemoryPersistence;
|
|
7285
7336
|
const browserSessionPersistence = inMemoryPersistence;
|
|
7337
|
+
const browserCookiePersistence = inMemoryPersistence;
|
|
7286
7338
|
const indexedDBLocalPersistence = inMemoryPersistence;
|
|
7287
7339
|
const browserPopupRedirectResolver = NOT_AVAILABLE_ERROR;
|
|
7288
7340
|
const PhoneAuthProvider = FailClass;
|
|
@@ -7541,6 +7593,7 @@ exports._serverAppCurrentUserOperationNotSupportedError = _serverAppCurrentUserO
|
|
|
7541
7593
|
exports._signInWithCredential = _signInWithCredential;
|
|
7542
7594
|
exports.applyActionCode = applyActionCode;
|
|
7543
7595
|
exports.beforeAuthStateChanged = beforeAuthStateChanged;
|
|
7596
|
+
exports.browserCookiePersistence = browserCookiePersistence;
|
|
7544
7597
|
exports.browserLocalPersistence = browserLocalPersistence;
|
|
7545
7598
|
exports.browserPopupRedirectResolver = browserPopupRedirectResolver;
|
|
7546
7599
|
exports.browserSessionPersistence = browserSessionPersistence;
|
|
@@ -7602,4 +7655,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
7602
7655
|
exports.validatePassword = validatePassword;
|
|
7603
7656
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
7604
7657
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
7605
|
-
//# sourceMappingURL=totp-
|
|
7658
|
+
//# sourceMappingURL=totp-af329771.js.map
|