@firebase/auth 1.9.1 → 1.10.0-auth-redirect-credentials.82faa0828
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-d5da52c1.js} +215 -16
- package/dist/browser-cjs/index-d5da52c1.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-79d5de9a.js} +71 -17
- package/dist/cordova/popup_redirect-79d5de9a.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-fc6bc882.js} +216 -18
- package/dist/esm2017/index-fc6bc882.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 +70 -16
- 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-88cb8aaf.js} +72 -16
- package/dist/node/totp-88cb8aaf.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-91f8ecc7.js} +73 -18
- package/dist/node-esm/totp-91f8ecc7.js.map +1 -0
- package/dist/rn/{index-ee081591.js → index-be8638d6.js} +70 -16
- package/dist/rn/index-be8638d6.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-878ee631.js} +70 -16
- package/dist/web-extension-cjs/register-878ee631.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-59e2f235.js} +71 -17
- package/dist/web-extension-esm2017/register-59e2f235.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 +8 -7
- 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,10 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
897
905
|
if (!util.isCloudflareWorker()) {
|
|
898
906
|
fetchArgs.referrerPolicy = 'no-referrer';
|
|
899
907
|
}
|
|
900
|
-
|
|
908
|
+
if (auth.emulatorConfig && util.isCloudWorkstation(auth.emulatorConfig.host)) {
|
|
909
|
+
fetchArgs.credentials = 'include';
|
|
910
|
+
}
|
|
911
|
+
return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);
|
|
901
912
|
});
|
|
902
913
|
}
|
|
903
914
|
async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
@@ -962,12 +973,25 @@ async function _performSignInRequest(auth, method, path, request, customErrorMap
|
|
|
962
973
|
}
|
|
963
974
|
return serverResponse;
|
|
964
975
|
}
|
|
965
|
-
function _getFinalTarget(auth, host, path, query) {
|
|
976
|
+
async function _getFinalTarget(auth, host, path, query) {
|
|
966
977
|
const base = `${host}${path}?${query}`;
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
978
|
+
const authInternal = auth;
|
|
979
|
+
const finalTarget = authInternal.config.emulator
|
|
980
|
+
? _emulatorUrl(auth.config, base)
|
|
981
|
+
: `${auth.config.apiScheme}://${base}`;
|
|
982
|
+
// Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,
|
|
983
|
+
// saving the idToken and refreshToken into cookies, and then redacting the refreshToken
|
|
984
|
+
// from the response
|
|
985
|
+
if (CookieAuthProxiedEndpoints.includes(path)) {
|
|
986
|
+
// Persistence manager is async, we need to await it. We can't just wait for auth initialized
|
|
987
|
+
// here since auth initialization calls this function.
|
|
988
|
+
await authInternal._persistenceManagerAvailable;
|
|
989
|
+
if (authInternal._getPersistenceType() === "COOKIE" /* PersistenceType.COOKIE */) {
|
|
990
|
+
const cookiePersistence = authInternal._getPersistence();
|
|
991
|
+
return cookiePersistence._getFinalTarget(finalTarget).toString();
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
return finalTarget;
|
|
971
995
|
}
|
|
972
996
|
function _parseEnforcementState(enforcementStateStr) {
|
|
973
997
|
switch (enforcementStateStr) {
|
|
@@ -1536,7 +1560,7 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1536
1560
|
'refresh_token': refreshToken
|
|
1537
1561
|
}).slice(1);
|
|
1538
1562
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1539
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1563
|
+
const url = await _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1540
1564
|
const headers = await auth._getAdditionalHeaders();
|
|
1541
1565
|
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1542
1566
|
return FetchProvider.fetch()(url, {
|
|
@@ -2027,7 +2051,17 @@ class PersistenceUserManager {
|
|
|
2027
2051
|
}
|
|
2028
2052
|
async getCurrentUser() {
|
|
2029
2053
|
const blob = await this.persistence._get(this.fullUserKey);
|
|
2030
|
-
|
|
2054
|
+
if (!blob) {
|
|
2055
|
+
return null;
|
|
2056
|
+
}
|
|
2057
|
+
if (typeof blob === 'string') {
|
|
2058
|
+
const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined);
|
|
2059
|
+
if (!response) {
|
|
2060
|
+
return null;
|
|
2061
|
+
}
|
|
2062
|
+
return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);
|
|
2063
|
+
}
|
|
2064
|
+
return UserImpl._fromJSON(this.auth, blob);
|
|
2031
2065
|
}
|
|
2032
2066
|
removeCurrentUser() {
|
|
2033
2067
|
return this.persistence._remove(this.fullUserKey);
|
|
@@ -2074,7 +2108,19 @@ class PersistenceUserManager {
|
|
|
2074
2108
|
try {
|
|
2075
2109
|
const blob = await persistence._get(key);
|
|
2076
2110
|
if (blob) {
|
|
2077
|
-
|
|
2111
|
+
let user;
|
|
2112
|
+
if (typeof blob === 'string') {
|
|
2113
|
+
const response = await getAccountInfo(auth, {
|
|
2114
|
+
idToken: blob
|
|
2115
|
+
}).catch(() => undefined);
|
|
2116
|
+
if (!response) {
|
|
2117
|
+
break;
|
|
2118
|
+
}
|
|
2119
|
+
user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob);
|
|
2120
|
+
}
|
|
2121
|
+
else {
|
|
2122
|
+
user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
|
|
2123
|
+
}
|
|
2078
2124
|
if (persistence !== selectedPersistence) {
|
|
2079
2125
|
userToMigrate = user;
|
|
2080
2126
|
}
|
|
@@ -2568,6 +2614,7 @@ class AuthImpl {
|
|
|
2568
2614
|
this._tenantRecaptchaConfigs = {};
|
|
2569
2615
|
this._projectPasswordPolicy = null;
|
|
2570
2616
|
this._tenantPasswordPolicies = {};
|
|
2617
|
+
this._resolvePersistenceManagerAvailable = undefined;
|
|
2571
2618
|
// Tracks the last notified UID for state change listeners to prevent
|
|
2572
2619
|
// repeated calls to the callbacks. Undefined means it's never been
|
|
2573
2620
|
// called, whereas null means it's been called with a signed out user
|
|
@@ -2578,6 +2625,9 @@ class AuthImpl {
|
|
|
2578
2625
|
this.frameworks = [];
|
|
2579
2626
|
this.name = app.name;
|
|
2580
2627
|
this.clientVersion = config.sdkClientVersion;
|
|
2628
|
+
// TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs
|
|
2629
|
+
// persistenceMananger to be available. see _getFinalTarget for more context
|
|
2630
|
+
this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve));
|
|
2581
2631
|
}
|
|
2582
2632
|
_initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {
|
|
2583
2633
|
if (popupRedirectResolver) {
|
|
@@ -2586,17 +2636,18 @@ class AuthImpl {
|
|
|
2586
2636
|
// Have to check for app deletion throughout initialization (after each
|
|
2587
2637
|
// promise resolution)
|
|
2588
2638
|
this._initializationPromise = this.queue(async () => {
|
|
2589
|
-
var _a, _b;
|
|
2639
|
+
var _a, _b, _c;
|
|
2590
2640
|
if (this._deleted) {
|
|
2591
2641
|
return;
|
|
2592
2642
|
}
|
|
2593
2643
|
this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
|
|
2644
|
+
(_a = this._resolvePersistenceManagerAvailable) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2594
2645
|
if (this._deleted) {
|
|
2595
2646
|
return;
|
|
2596
2647
|
}
|
|
2597
2648
|
// Initialize the resolver early if necessary (only applicable to web:
|
|
2598
2649
|
// this will cause the iframe to load immediately in certain cases)
|
|
2599
|
-
if ((
|
|
2650
|
+
if ((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively) {
|
|
2600
2651
|
// If this fails, don't halt auth loading
|
|
2601
2652
|
try {
|
|
2602
2653
|
await this._popupRedirectResolver._initialize(this);
|
|
@@ -2606,7 +2657,7 @@ class AuthImpl {
|
|
|
2606
2657
|
}
|
|
2607
2658
|
}
|
|
2608
2659
|
await this.initializeCurrentUser(popupRedirectResolver);
|
|
2609
|
-
this.lastNotifiedUid = ((
|
|
2660
|
+
this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;
|
|
2610
2661
|
if (this._deleted) {
|
|
2611
2662
|
return;
|
|
2612
2663
|
}
|
|
@@ -2860,9 +2911,12 @@ class AuthImpl {
|
|
|
2860
2911
|
this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;
|
|
2861
2912
|
}
|
|
2862
2913
|
}
|
|
2863
|
-
|
|
2914
|
+
_getPersistenceType() {
|
|
2864
2915
|
return this.assertedPersistence.persistence.type;
|
|
2865
2916
|
}
|
|
2917
|
+
_getPersistence() {
|
|
2918
|
+
return this.assertedPersistence.persistence;
|
|
2919
|
+
}
|
|
2866
2920
|
_updateErrorMap(errorMap) {
|
|
2867
2921
|
this._errorFactory = new util.ErrorFactory('auth', 'Firebase', errorMap());
|
|
2868
2922
|
}
|
|
@@ -4301,7 +4355,7 @@ class ActionCodeURL {
|
|
|
4301
4355
|
this.operation = operation;
|
|
4302
4356
|
this.code = code;
|
|
4303
4357
|
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4304
|
-
this.languageCode = (_e = searchParams["
|
|
4358
|
+
this.languageCode = (_e = searchParams["lang" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4305
4359
|
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4306
4360
|
}
|
|
4307
4361
|
/**
|
|
@@ -7081,7 +7135,7 @@ function multiFactor(user) {
|
|
|
7081
7135
|
}
|
|
7082
7136
|
|
|
7083
7137
|
var name = "@firebase/auth";
|
|
7084
|
-
var version = "1.
|
|
7138
|
+
var version = "1.10.0-auth-redirect-credentials.82faa0828";
|
|
7085
7139
|
|
|
7086
7140
|
/**
|
|
7087
7141
|
* @license
|
|
@@ -7283,6 +7337,7 @@ class FailClass {
|
|
|
7283
7337
|
}
|
|
7284
7338
|
const browserLocalPersistence = inMemoryPersistence;
|
|
7285
7339
|
const browserSessionPersistence = inMemoryPersistence;
|
|
7340
|
+
const browserCookiePersistence = inMemoryPersistence;
|
|
7286
7341
|
const indexedDBLocalPersistence = inMemoryPersistence;
|
|
7287
7342
|
const browserPopupRedirectResolver = NOT_AVAILABLE_ERROR;
|
|
7288
7343
|
const PhoneAuthProvider = FailClass;
|
|
@@ -7541,6 +7596,7 @@ exports._serverAppCurrentUserOperationNotSupportedError = _serverAppCurrentUserO
|
|
|
7541
7596
|
exports._signInWithCredential = _signInWithCredential;
|
|
7542
7597
|
exports.applyActionCode = applyActionCode;
|
|
7543
7598
|
exports.beforeAuthStateChanged = beforeAuthStateChanged;
|
|
7599
|
+
exports.browserCookiePersistence = browserCookiePersistence;
|
|
7544
7600
|
exports.browserLocalPersistence = browserLocalPersistence;
|
|
7545
7601
|
exports.browserPopupRedirectResolver = browserPopupRedirectResolver;
|
|
7546
7602
|
exports.browserSessionPersistence = browserSessionPersistence;
|
|
@@ -7602,4 +7658,4 @@ exports.useDeviceLanguage = useDeviceLanguage;
|
|
|
7602
7658
|
exports.validatePassword = validatePassword;
|
|
7603
7659
|
exports.verifyBeforeUpdateEmail = verifyBeforeUpdateEmail;
|
|
7604
7660
|
exports.verifyPasswordResetCode = verifyPasswordResetCode;
|
|
7605
|
-
//# sourceMappingURL=totp-
|
|
7661
|
+
//# sourceMappingURL=totp-88cb8aaf.js.map
|