@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
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SDK_VERSION, _isFirebaseServerApp, _getProvider, _registerComponent, registerVersion, getApp } from '@firebase/app';
|
|
2
|
-
import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, querystringDecode, extractQuerystring, getDefaultEmulatorHost } from '@firebase/util';
|
|
2
|
+
import { ErrorFactory, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, isCloudWorkstation, getModularInstance, base64Decode, getUA, isIE, createSubscribe, deepEqual, querystringDecode, extractQuerystring, getDefaultEmulatorHost } from '@firebase/util';
|
|
3
3
|
import { __rest } from 'tslib';
|
|
4
4
|
import { Component } from '@firebase/component';
|
|
5
5
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
@@ -859,6 +859,14 @@ const SERVER_ERROR_MAP = {
|
|
|
859
859
|
* See the License for the specific language governing permissions and
|
|
860
860
|
* limitations under the License.
|
|
861
861
|
*/
|
|
862
|
+
const CookieAuthProxiedEndpoints = [
|
|
863
|
+
"/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */,
|
|
864
|
+
"/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */,
|
|
865
|
+
"/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */,
|
|
866
|
+
"/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */,
|
|
867
|
+
"/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */,
|
|
868
|
+
"/v1/token" /* Endpoint.TOKEN */
|
|
869
|
+
];
|
|
862
870
|
const DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);
|
|
863
871
|
function _addTidIfNecessary(auth, request) {
|
|
864
872
|
if (auth.tenantId && !request.tenantId) {
|
|
@@ -895,7 +903,10 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
895
903
|
if (!isCloudflareWorker()) {
|
|
896
904
|
fetchArgs.referrerPolicy = 'no-referrer';
|
|
897
905
|
}
|
|
898
|
-
|
|
906
|
+
if (auth.emulatorConfig && isCloudWorkstation(auth.emulatorConfig.host)) {
|
|
907
|
+
fetchArgs.credentials = 'include';
|
|
908
|
+
}
|
|
909
|
+
return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);
|
|
899
910
|
});
|
|
900
911
|
}
|
|
901
912
|
async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
@@ -960,12 +971,25 @@ async function _performSignInRequest(auth, method, path, request, customErrorMap
|
|
|
960
971
|
}
|
|
961
972
|
return serverResponse;
|
|
962
973
|
}
|
|
963
|
-
function _getFinalTarget(auth, host, path, query) {
|
|
974
|
+
async function _getFinalTarget(auth, host, path, query) {
|
|
964
975
|
const base = `${host}${path}?${query}`;
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
976
|
+
const authInternal = auth;
|
|
977
|
+
const finalTarget = authInternal.config.emulator
|
|
978
|
+
? _emulatorUrl(auth.config, base)
|
|
979
|
+
: `${auth.config.apiScheme}://${base}`;
|
|
980
|
+
// Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,
|
|
981
|
+
// saving the idToken and refreshToken into cookies, and then redacting the refreshToken
|
|
982
|
+
// from the response
|
|
983
|
+
if (CookieAuthProxiedEndpoints.includes(path)) {
|
|
984
|
+
// Persistence manager is async, we need to await it. We can't just wait for auth initialized
|
|
985
|
+
// here since auth initialization calls this function.
|
|
986
|
+
await authInternal._persistenceManagerAvailable;
|
|
987
|
+
if (authInternal._getPersistenceType() === "COOKIE" /* PersistenceType.COOKIE */) {
|
|
988
|
+
const cookiePersistence = authInternal._getPersistence();
|
|
989
|
+
return cookiePersistence._getFinalTarget(finalTarget).toString();
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return finalTarget;
|
|
969
993
|
}
|
|
970
994
|
function _parseEnforcementState(enforcementStateStr) {
|
|
971
995
|
switch (enforcementStateStr) {
|
|
@@ -1534,7 +1558,7 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1534
1558
|
'refresh_token': refreshToken
|
|
1535
1559
|
}).slice(1);
|
|
1536
1560
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1537
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1561
|
+
const url = await _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1538
1562
|
const headers = await auth._getAdditionalHeaders();
|
|
1539
1563
|
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1540
1564
|
return FetchProvider.fetch()(url, {
|
|
@@ -2025,7 +2049,17 @@ class PersistenceUserManager {
|
|
|
2025
2049
|
}
|
|
2026
2050
|
async getCurrentUser() {
|
|
2027
2051
|
const blob = await this.persistence._get(this.fullUserKey);
|
|
2028
|
-
|
|
2052
|
+
if (!blob) {
|
|
2053
|
+
return null;
|
|
2054
|
+
}
|
|
2055
|
+
if (typeof blob === 'string') {
|
|
2056
|
+
const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined);
|
|
2057
|
+
if (!response) {
|
|
2058
|
+
return null;
|
|
2059
|
+
}
|
|
2060
|
+
return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);
|
|
2061
|
+
}
|
|
2062
|
+
return UserImpl._fromJSON(this.auth, blob);
|
|
2029
2063
|
}
|
|
2030
2064
|
removeCurrentUser() {
|
|
2031
2065
|
return this.persistence._remove(this.fullUserKey);
|
|
@@ -2072,7 +2106,19 @@ class PersistenceUserManager {
|
|
|
2072
2106
|
try {
|
|
2073
2107
|
const blob = await persistence._get(key);
|
|
2074
2108
|
if (blob) {
|
|
2075
|
-
|
|
2109
|
+
let user;
|
|
2110
|
+
if (typeof blob === 'string') {
|
|
2111
|
+
const response = await getAccountInfo(auth, {
|
|
2112
|
+
idToken: blob
|
|
2113
|
+
}).catch(() => undefined);
|
|
2114
|
+
if (!response) {
|
|
2115
|
+
break;
|
|
2116
|
+
}
|
|
2117
|
+
user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob);
|
|
2118
|
+
}
|
|
2119
|
+
else {
|
|
2120
|
+
user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
|
|
2121
|
+
}
|
|
2076
2122
|
if (persistence !== selectedPersistence) {
|
|
2077
2123
|
userToMigrate = user;
|
|
2078
2124
|
}
|
|
@@ -2566,6 +2612,7 @@ class AuthImpl {
|
|
|
2566
2612
|
this._tenantRecaptchaConfigs = {};
|
|
2567
2613
|
this._projectPasswordPolicy = null;
|
|
2568
2614
|
this._tenantPasswordPolicies = {};
|
|
2615
|
+
this._resolvePersistenceManagerAvailable = undefined;
|
|
2569
2616
|
// Tracks the last notified UID for state change listeners to prevent
|
|
2570
2617
|
// repeated calls to the callbacks. Undefined means it's never been
|
|
2571
2618
|
// called, whereas null means it's been called with a signed out user
|
|
@@ -2576,6 +2623,9 @@ class AuthImpl {
|
|
|
2576
2623
|
this.frameworks = [];
|
|
2577
2624
|
this.name = app.name;
|
|
2578
2625
|
this.clientVersion = config.sdkClientVersion;
|
|
2626
|
+
// TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs
|
|
2627
|
+
// persistenceMananger to be available. see _getFinalTarget for more context
|
|
2628
|
+
this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve));
|
|
2579
2629
|
}
|
|
2580
2630
|
_initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {
|
|
2581
2631
|
if (popupRedirectResolver) {
|
|
@@ -2584,17 +2634,18 @@ class AuthImpl {
|
|
|
2584
2634
|
// Have to check for app deletion throughout initialization (after each
|
|
2585
2635
|
// promise resolution)
|
|
2586
2636
|
this._initializationPromise = this.queue(async () => {
|
|
2587
|
-
var _a, _b;
|
|
2637
|
+
var _a, _b, _c;
|
|
2588
2638
|
if (this._deleted) {
|
|
2589
2639
|
return;
|
|
2590
2640
|
}
|
|
2591
2641
|
this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
|
|
2642
|
+
(_a = this._resolvePersistenceManagerAvailable) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2592
2643
|
if (this._deleted) {
|
|
2593
2644
|
return;
|
|
2594
2645
|
}
|
|
2595
2646
|
// Initialize the resolver early if necessary (only applicable to web:
|
|
2596
2647
|
// this will cause the iframe to load immediately in certain cases)
|
|
2597
|
-
if ((
|
|
2648
|
+
if ((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively) {
|
|
2598
2649
|
// If this fails, don't halt auth loading
|
|
2599
2650
|
try {
|
|
2600
2651
|
await this._popupRedirectResolver._initialize(this);
|
|
@@ -2604,7 +2655,7 @@ class AuthImpl {
|
|
|
2604
2655
|
}
|
|
2605
2656
|
}
|
|
2606
2657
|
await this.initializeCurrentUser(popupRedirectResolver);
|
|
2607
|
-
this.lastNotifiedUid = ((
|
|
2658
|
+
this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;
|
|
2608
2659
|
if (this._deleted) {
|
|
2609
2660
|
return;
|
|
2610
2661
|
}
|
|
@@ -2858,9 +2909,12 @@ class AuthImpl {
|
|
|
2858
2909
|
this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;
|
|
2859
2910
|
}
|
|
2860
2911
|
}
|
|
2861
|
-
|
|
2912
|
+
_getPersistenceType() {
|
|
2862
2913
|
return this.assertedPersistence.persistence.type;
|
|
2863
2914
|
}
|
|
2915
|
+
_getPersistence() {
|
|
2916
|
+
return this.assertedPersistence.persistence;
|
|
2917
|
+
}
|
|
2864
2918
|
_updateErrorMap(errorMap) {
|
|
2865
2919
|
this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap());
|
|
2866
2920
|
}
|
|
@@ -4299,7 +4353,7 @@ class ActionCodeURL {
|
|
|
4299
4353
|
this.operation = operation;
|
|
4300
4354
|
this.code = code;
|
|
4301
4355
|
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
4302
|
-
this.languageCode = (_e = searchParams["
|
|
4356
|
+
this.languageCode = (_e = searchParams["lang" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
4303
4357
|
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
4304
4358
|
}
|
|
4305
4359
|
/**
|
|
@@ -7079,7 +7133,7 @@ function multiFactor(user) {
|
|
|
7079
7133
|
}
|
|
7080
7134
|
|
|
7081
7135
|
var name = "@firebase/auth";
|
|
7082
|
-
var version = "1.
|
|
7136
|
+
var version = "1.10.0-auth-redirect-credentials.82faa0828";
|
|
7083
7137
|
|
|
7084
7138
|
/**
|
|
7085
7139
|
* @license
|
|
@@ -7281,6 +7335,7 @@ class FailClass {
|
|
|
7281
7335
|
}
|
|
7282
7336
|
const browserLocalPersistence = inMemoryPersistence;
|
|
7283
7337
|
const browserSessionPersistence = inMemoryPersistence;
|
|
7338
|
+
const browserCookiePersistence = inMemoryPersistence;
|
|
7284
7339
|
const indexedDBLocalPersistence = inMemoryPersistence;
|
|
7285
7340
|
const browserPopupRedirectResolver = NOT_AVAILABLE_ERROR;
|
|
7286
7341
|
const PhoneAuthProvider = FailClass;
|
|
@@ -7490,5 +7545,5 @@ function _isEmptyString(input) {
|
|
|
7490
7545
|
return typeof input === 'undefined' || (input === null || input === void 0 ? void 0 : input.length) === 0;
|
|
7491
7546
|
}
|
|
7492
7547
|
|
|
7493
|
-
export {
|
|
7494
|
-
//# sourceMappingURL=totp-
|
|
7548
|
+
export { SAMLAuthProvider as $, ActionCodeOperation as A, useDeviceLanguage as B, updateCurrentUser as C, signOut as D, revokeAccessToken as E, FactorId as F, deleteUser as G, debugErrorMap as H, prodErrorMap as I, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as J, initializeAuth as K, connectAuthEmulator as L, AuthCredential as M, EmailAuthCredential as N, OperationType as O, PhoneAuthProvider as P, OAuthCredential as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, PhoneAuthCredential as U, inMemoryPersistence as V, EmailAuthProvider as W, FacebookAuthProvider as X, GoogleAuthProvider as Y, GithubAuthProvider as Z, OAuthProvider as _, browserCookiePersistence as a, TwitterAuthProvider as a0, signInAnonymously as a1, signInWithCredential as a2, linkWithCredential as a3, reauthenticateWithCredential as a4, signInWithCustomToken as a5, sendPasswordResetEmail as a6, confirmPasswordReset as a7, applyActionCode as a8, checkActionCode as a9, signInWithIdp as aA, _fail as aB, debugAssert as aC, _persistenceKeyName as aD, _serverAppCurrentUserOperationNotSupportedError as aE, _castAuth as aF, FederatedAuthProvider as aG, BaseOAuthProvider as aH, _emulatorUrl as aI, _performApiRequest as aJ, _isIOS as aK, _isAndroid as aL, _isIOS7Or8 as aM, _createError as aN, _isMobileBrowser as aO, _isIE10 as aP, UserImpl as aQ, AuthImpl as aR, _getClientVersion as aS, FetchProvider as aT, SAMLAuthCredential as aU, verifyPasswordResetCode as aa, createUserWithEmailAndPassword as ab, signInWithEmailAndPassword as ac, sendSignInLinkToEmail as ad, isSignInWithEmailLink as ae, signInWithEmailLink as af, fetchSignInMethodsForEmail as ag, sendEmailVerification as ah, verifyBeforeUpdateEmail as ai, ActionCodeURL as aj, parseActionCodeURL as ak, updateProfile as al, updateEmail as am, updatePassword as an, getIdToken as ao, getIdTokenResult as ap, unlink as aq, getAdditionalUserInfo as ar, reload as as, getMultiFactorResolver as at, multiFactor as au, _getInstance as av, _assert as aw, _signInWithCredential as ax, _reauthenticate as ay, _link as az, browserLocalPersistence as b, browserSessionPersistence as c, signInWithPopup as d, linkWithPopup as e, reauthenticateWithPopup as f, signInWithRedirect as g, linkWithRedirect as h, indexedDBLocalPersistence as i, reauthenticateWithRedirect as j, getRedirectResult as k, linkWithPhoneNumber as l, browserPopupRedirectResolver as m, PhoneMultiFactorGenerator as n, TotpSecret as o, getAuth as p, ProviderId as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, setPersistence as t, updatePhoneNumber as u, initializeRecaptchaConfig as v, validatePassword as w, onIdTokenChanged as x, beforeAuthStateChanged as y, onAuthStateChanged as z };
|
|
7549
|
+
//# sourceMappingURL=totp-91f8ecc7.js.map
|