@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
package/dist/esm2017/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './src/model/public_types';
|
|
|
23
23
|
export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps';
|
|
24
24
|
export * from './src';
|
|
25
25
|
import { browserLocalPersistence } from './src/platform_browser/persistence/local_storage';
|
|
26
|
+
import { browserCookiePersistence } from './src/platform_browser/persistence/cookie_storage';
|
|
26
27
|
import { browserSessionPersistence } from './src/platform_browser/persistence/session_storage';
|
|
27
28
|
import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
|
|
28
29
|
import { PhoneAuthProvider } from './src/platform_browser/providers/phone';
|
|
@@ -34,4 +35,4 @@ import { browserPopupRedirectResolver } from './src/platform_browser/popup_redir
|
|
|
34
35
|
import { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
|
|
35
36
|
import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
|
|
36
37
|
import { getAuth } from './src/platform_browser';
|
|
37
|
-
export { browserLocalPersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth };
|
|
38
|
+
export { browserLocalPersistence, browserCookiePersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth };
|
package/dist/esm2017/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ActionCodeOperation,
|
|
1
|
+
export { A as ActionCodeOperation, aj as ActionCodeURL, M as AuthCredential, J as AuthErrorCodes, N as EmailAuthCredential, W as EmailAuthProvider, X as FacebookAuthProvider, F as FactorId, Z as GithubAuthProvider, Y as GoogleAuthProvider, Q as OAuthCredential, _ as OAuthProvider, O as OperationType, U as PhoneAuthCredential, P as PhoneAuthProvider, n as PhoneMultiFactorGenerator, q as ProviderId, R as RecaptchaVerifier, $ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, o as TotpSecret, a0 as TwitterAuthProvider, a8 as applyActionCode, y as beforeAuthStateChanged, a as browserCookiePersistence, b as browserLocalPersistence, m as browserPopupRedirectResolver, c as browserSessionPersistence, a9 as checkActionCode, a7 as confirmPasswordReset, L as connectAuthEmulator, ab as createUserWithEmailAndPassword, H as debugErrorMap, G as deleteUser, ag as fetchSignInMethodsForEmail, ar as getAdditionalUserInfo, p as getAuth, ao as getIdToken, ap as getIdTokenResult, at as getMultiFactorResolver, k as getRedirectResult, V as inMemoryPersistence, i as indexedDBLocalPersistence, K as initializeAuth, v as initializeRecaptchaConfig, ae as isSignInWithEmailLink, a3 as linkWithCredential, l as linkWithPhoneNumber, e as linkWithPopup, h as linkWithRedirect, au as multiFactor, z as onAuthStateChanged, x as onIdTokenChanged, ak as parseActionCodeURL, I as prodErrorMap, a4 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, f as reauthenticateWithPopup, j as reauthenticateWithRedirect, as as reload, E as revokeAccessToken, ah as sendEmailVerification, a6 as sendPasswordResetEmail, ad as sendSignInLinkToEmail, t as setPersistence, a1 as signInAnonymously, a2 as signInWithCredential, a5 as signInWithCustomToken, ac as signInWithEmailAndPassword, af as signInWithEmailLink, s as signInWithPhoneNumber, d as signInWithPopup, g as signInWithRedirect, D as signOut, aq as unlink, C as updateCurrentUser, am as updateEmail, an as updatePassword, u as updatePhoneNumber, al as updateProfile, B as useDeviceLanguage, w as validatePassword, ai as verifyBeforeUpdateEmail, aa as verifyPasswordResetCode } from './index-fc6bc882.js';
|
|
2
2
|
import '@firebase/app';
|
|
3
3
|
import '@firebase/util';
|
|
4
4
|
import '@firebase/logger';
|
package/dist/esm2017/internal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActionCodeOperation,
|
|
1
|
+
import { av as debugAssert, aw as _isIOS, ax as _isAndroid, ay as _fail, az as _getRedirectUrl, aA as _getProjectConfig, aB as _isIOS7Or8, aC as _createError, aD as _assert, aE as AuthEventManager, aF as _getInstance, b as browserLocalPersistence, aG as _persistenceKeyName, c as browserSessionPersistence, aH as _getRedirectResult, aI as _overrideRedirectResult, aJ as _clearRedirectOutcomes, aK as _castAuth } from './index-fc6bc882.js';
|
|
2
|
+
export { A as ActionCodeOperation, aj as ActionCodeURL, M as AuthCredential, J as AuthErrorCodes, aM as AuthImpl, aP as AuthPopup, N as EmailAuthCredential, W as EmailAuthProvider, X as FacebookAuthProvider, F as FactorId, aQ as FetchProvider, Z as GithubAuthProvider, Y as GoogleAuthProvider, Q as OAuthCredential, _ as OAuthProvider, O as OperationType, U as PhoneAuthCredential, P as PhoneAuthProvider, n as PhoneMultiFactorGenerator, q as ProviderId, R as RecaptchaVerifier, aR as SAMLAuthCredential, $ as SAMLAuthProvider, S as SignInMethod, T as TotpMultiFactorGenerator, o as TotpSecret, a0 as TwitterAuthProvider, aL as UserImpl, aD as _assert, aK as _castAuth, ay as _fail, aO as _generateEventId, aN as _getClientVersion, aF as _getInstance, aH as _getRedirectResult, aI as _overrideRedirectResult, aG as _persistenceKeyName, a8 as applyActionCode, y as beforeAuthStateChanged, a as browserCookiePersistence, b as browserLocalPersistence, m as browserPopupRedirectResolver, c as browserSessionPersistence, a9 as checkActionCode, a7 as confirmPasswordReset, L as connectAuthEmulator, ab as createUserWithEmailAndPassword, H as debugErrorMap, G as deleteUser, ag as fetchSignInMethodsForEmail, ar as getAdditionalUserInfo, p as getAuth, ao as getIdToken, ap as getIdTokenResult, at as getMultiFactorResolver, k as getRedirectResult, V as inMemoryPersistence, i as indexedDBLocalPersistence, K as initializeAuth, v as initializeRecaptchaConfig, ae as isSignInWithEmailLink, a3 as linkWithCredential, l as linkWithPhoneNumber, e as linkWithPopup, h as linkWithRedirect, au as multiFactor, z as onAuthStateChanged, x as onIdTokenChanged, ak as parseActionCodeURL, I as prodErrorMap, a4 as reauthenticateWithCredential, r as reauthenticateWithPhoneNumber, f as reauthenticateWithPopup, j as reauthenticateWithRedirect, as as reload, E as revokeAccessToken, ah as sendEmailVerification, a6 as sendPasswordResetEmail, ad as sendSignInLinkToEmail, t as setPersistence, a1 as signInAnonymously, a2 as signInWithCredential, a5 as signInWithCustomToken, ac as signInWithEmailAndPassword, af as signInWithEmailLink, s as signInWithPhoneNumber, d as signInWithPopup, g as signInWithRedirect, D as signOut, aq as unlink, C as updateCurrentUser, am as updateEmail, an as updatePassword, u as updatePhoneNumber, al as updateProfile, B as useDeviceLanguage, w as validatePassword, ai as verifyBeforeUpdateEmail, aa as verifyPasswordResetCode } from './index-fc6bc882.js';
|
|
3
3
|
import { querystringDecode } from '@firebase/util';
|
|
4
4
|
import '@firebase/app';
|
|
5
5
|
import '@firebase/logger';
|
|
@@ -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;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './src/model/public_types';
|
|
|
23
23
|
export { FactorId, ProviderId, SignInMethod, OperationType, ActionCodeOperation } from './src/model/enum_maps';
|
|
24
24
|
export * from './src';
|
|
25
25
|
import { browserLocalPersistence } from './src/platform_browser/persistence/local_storage';
|
|
26
|
+
import { browserCookiePersistence } from './src/platform_browser/persistence/cookie_storage';
|
|
26
27
|
import { browserSessionPersistence } from './src/platform_browser/persistence/session_storage';
|
|
27
28
|
import { indexedDBLocalPersistence } from './src/platform_browser/persistence/indexed_db';
|
|
28
29
|
import { PhoneAuthProvider } from './src/platform_browser/providers/phone';
|
|
@@ -34,4 +35,4 @@ import { browserPopupRedirectResolver } from './src/platform_browser/popup_redir
|
|
|
34
35
|
import { PhoneMultiFactorGenerator } from './src/platform_browser/mfa/assertions/phone';
|
|
35
36
|
import { TotpMultiFactorGenerator, TotpSecret } from './src/mfa/assertions/totp';
|
|
36
37
|
import { getAuth } from './src/platform_browser';
|
|
37
|
-
export { browserLocalPersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth };
|
|
38
|
+
export { browserLocalPersistence, browserCookiePersistence, browserSessionPersistence, indexedDBLocalPersistence, PhoneAuthProvider, signInWithPhoneNumber, linkWithPhoneNumber, reauthenticateWithPhoneNumber, updatePhoneNumber, signInWithPopup, linkWithPopup, reauthenticateWithPopup, signInWithRedirect, linkWithRedirect, reauthenticateWithRedirect, getRedirectResult, RecaptchaVerifier, browserPopupRedirectResolver, PhoneMultiFactorGenerator, TotpMultiFactorGenerator, TotpSecret, getAuth };
|
package/dist/index.webworker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SDK_VERSION, _getProvider, _isFirebaseServerApp, _registerComponent, registerVersion, getApp } from '@firebase/app';
|
|
2
|
-
import { ErrorFactory, deepEqual, getUA, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, getModularInstance, base64Decode, createSubscribe, querystringDecode, extractQuerystring } from '@firebase/util';
|
|
2
|
+
import { ErrorFactory, deepEqual, getUA, isBrowserExtension, isMobileCordova, isReactNative, FirebaseError, querystring, isCloudflareWorker, isCloudWorkstation, getModularInstance, base64Decode, createSubscribe, querystringDecode, extractQuerystring } from '@firebase/util';
|
|
3
3
|
import { Logger, LogLevel } from '@firebase/logger';
|
|
4
4
|
import { Component } from '@firebase/component';
|
|
5
5
|
import { __rest } from 'tslib';
|
|
@@ -530,7 +530,7 @@ function _initializeAuthInstance(auth, deps) {
|
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
var name = "@firebase/auth";
|
|
533
|
-
var version = "1.
|
|
533
|
+
var version = "1.10.0-auth-redirect-credentials.82faa0828";
|
|
534
534
|
|
|
535
535
|
/**
|
|
536
536
|
* @license
|
|
@@ -996,6 +996,14 @@ const SERVER_ERROR_MAP = {
|
|
|
996
996
|
* See the License for the specific language governing permissions and
|
|
997
997
|
* limitations under the License.
|
|
998
998
|
*/
|
|
999
|
+
const CookieAuthProxiedEndpoints = [
|
|
1000
|
+
"/v1/accounts:signInWithCustomToken" /* Endpoint.SIGN_IN_WITH_CUSTOM_TOKEN */,
|
|
1001
|
+
"/v1/accounts:signInWithEmailLink" /* Endpoint.SIGN_IN_WITH_EMAIL_LINK */,
|
|
1002
|
+
"/v1/accounts:signInWithIdp" /* Endpoint.SIGN_IN_WITH_IDP */,
|
|
1003
|
+
"/v1/accounts:signInWithPassword" /* Endpoint.SIGN_IN_WITH_PASSWORD */,
|
|
1004
|
+
"/v1/accounts:signInWithPhoneNumber" /* Endpoint.SIGN_IN_WITH_PHONE_NUMBER */,
|
|
1005
|
+
"/v1/token" /* Endpoint.TOKEN */
|
|
1006
|
+
];
|
|
999
1007
|
const DEFAULT_API_TIMEOUT_MS = new Delay(30000, 60000);
|
|
1000
1008
|
function _addTidIfNecessary(auth, request) {
|
|
1001
1009
|
if (auth.tenantId && !request.tenantId) {
|
|
@@ -1032,7 +1040,10 @@ async function _performApiRequest(auth, method, path, request, customErrorMap =
|
|
|
1032
1040
|
if (!isCloudflareWorker()) {
|
|
1033
1041
|
fetchArgs.referrerPolicy = 'no-referrer';
|
|
1034
1042
|
}
|
|
1035
|
-
|
|
1043
|
+
if (auth.emulatorConfig && isCloudWorkstation(auth.emulatorConfig.host)) {
|
|
1044
|
+
fetchArgs.credentials = 'include';
|
|
1045
|
+
}
|
|
1046
|
+
return FetchProvider.fetch()(await _getFinalTarget(auth, auth.config.apiHost, path, query), fetchArgs);
|
|
1036
1047
|
});
|
|
1037
1048
|
}
|
|
1038
1049
|
async function _performFetchWithErrorHandling(auth, customErrorMap, fetchFn) {
|
|
@@ -1097,12 +1108,25 @@ async function _performSignInRequest(auth, method, path, request, customErrorMap
|
|
|
1097
1108
|
}
|
|
1098
1109
|
return serverResponse;
|
|
1099
1110
|
}
|
|
1100
|
-
function _getFinalTarget(auth, host, path, query) {
|
|
1111
|
+
async function _getFinalTarget(auth, host, path, query) {
|
|
1101
1112
|
const base = `${host}${path}?${query}`;
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1113
|
+
const authInternal = auth;
|
|
1114
|
+
const finalTarget = authInternal.config.emulator
|
|
1115
|
+
? _emulatorUrl(auth.config, base)
|
|
1116
|
+
: `${auth.config.apiScheme}://${base}`;
|
|
1117
|
+
// Cookie auth works by MiTMing the signIn and token endpoints from the developer's backend,
|
|
1118
|
+
// saving the idToken and refreshToken into cookies, and then redacting the refreshToken
|
|
1119
|
+
// from the response
|
|
1120
|
+
if (CookieAuthProxiedEndpoints.includes(path)) {
|
|
1121
|
+
// Persistence manager is async, we need to await it. We can't just wait for auth initialized
|
|
1122
|
+
// here since auth initialization calls this function.
|
|
1123
|
+
await authInternal._persistenceManagerAvailable;
|
|
1124
|
+
if (authInternal._getPersistenceType() === "COOKIE" /* PersistenceType.COOKIE */) {
|
|
1125
|
+
const cookiePersistence = authInternal._getPersistence();
|
|
1126
|
+
return cookiePersistence._getFinalTarget(finalTarget).toString();
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return finalTarget;
|
|
1106
1130
|
}
|
|
1107
1131
|
function _parseEnforcementState(enforcementStateStr) {
|
|
1108
1132
|
switch (enforcementStateStr) {
|
|
@@ -1572,7 +1596,7 @@ async function requestStsToken(auth, refreshToken) {
|
|
|
1572
1596
|
'refresh_token': refreshToken
|
|
1573
1597
|
}).slice(1);
|
|
1574
1598
|
const { tokenApiHost, apiKey } = auth.config;
|
|
1575
|
-
const url = _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1599
|
+
const url = await _getFinalTarget(auth, tokenApiHost, "/v1/token" /* Endpoint.TOKEN */, `key=${apiKey}`);
|
|
1576
1600
|
const headers = await auth._getAdditionalHeaders();
|
|
1577
1601
|
headers["Content-Type" /* HttpHeader.CONTENT_TYPE */] = 'application/x-www-form-urlencoded';
|
|
1578
1602
|
return FetchProvider.fetch()(url, {
|
|
@@ -2034,7 +2058,17 @@ class PersistenceUserManager {
|
|
|
2034
2058
|
}
|
|
2035
2059
|
async getCurrentUser() {
|
|
2036
2060
|
const blob = await this.persistence._get(this.fullUserKey);
|
|
2037
|
-
|
|
2061
|
+
if (!blob) {
|
|
2062
|
+
return null;
|
|
2063
|
+
}
|
|
2064
|
+
if (typeof blob === 'string') {
|
|
2065
|
+
const response = await getAccountInfo(this.auth, { idToken: blob }).catch(() => undefined);
|
|
2066
|
+
if (!response) {
|
|
2067
|
+
return null;
|
|
2068
|
+
}
|
|
2069
|
+
return UserImpl._fromGetAccountInfoResponse(this.auth, response, blob);
|
|
2070
|
+
}
|
|
2071
|
+
return UserImpl._fromJSON(this.auth, blob);
|
|
2038
2072
|
}
|
|
2039
2073
|
removeCurrentUser() {
|
|
2040
2074
|
return this.persistence._remove(this.fullUserKey);
|
|
@@ -2081,7 +2115,19 @@ class PersistenceUserManager {
|
|
|
2081
2115
|
try {
|
|
2082
2116
|
const blob = await persistence._get(key);
|
|
2083
2117
|
if (blob) {
|
|
2084
|
-
|
|
2118
|
+
let user;
|
|
2119
|
+
if (typeof blob === 'string') {
|
|
2120
|
+
const response = await getAccountInfo(auth, {
|
|
2121
|
+
idToken: blob
|
|
2122
|
+
}).catch(() => undefined);
|
|
2123
|
+
if (!response) {
|
|
2124
|
+
break;
|
|
2125
|
+
}
|
|
2126
|
+
user = await UserImpl._fromGetAccountInfoResponse(auth, response, blob);
|
|
2127
|
+
}
|
|
2128
|
+
else {
|
|
2129
|
+
user = UserImpl._fromJSON(auth, blob); // throws for unparsable blob (wrong format)
|
|
2130
|
+
}
|
|
2085
2131
|
if (persistence !== selectedPersistence) {
|
|
2086
2132
|
userToMigrate = user;
|
|
2087
2133
|
}
|
|
@@ -2419,6 +2465,7 @@ class AuthImpl {
|
|
|
2419
2465
|
this._tenantRecaptchaConfigs = {};
|
|
2420
2466
|
this._projectPasswordPolicy = null;
|
|
2421
2467
|
this._tenantPasswordPolicies = {};
|
|
2468
|
+
this._resolvePersistenceManagerAvailable = undefined;
|
|
2422
2469
|
// Tracks the last notified UID for state change listeners to prevent
|
|
2423
2470
|
// repeated calls to the callbacks. Undefined means it's never been
|
|
2424
2471
|
// called, whereas null means it's been called with a signed out user
|
|
@@ -2429,6 +2476,9 @@ class AuthImpl {
|
|
|
2429
2476
|
this.frameworks = [];
|
|
2430
2477
|
this.name = app.name;
|
|
2431
2478
|
this.clientVersion = config.sdkClientVersion;
|
|
2479
|
+
// TODO(jamesdaniels) explore less hacky way to do this, cookie authentication needs
|
|
2480
|
+
// persistenceMananger to be available. see _getFinalTarget for more context
|
|
2481
|
+
this._persistenceManagerAvailable = new Promise(resolve => (this._resolvePersistenceManagerAvailable = resolve));
|
|
2432
2482
|
}
|
|
2433
2483
|
_initializeWithPersistence(persistenceHierarchy, popupRedirectResolver) {
|
|
2434
2484
|
if (popupRedirectResolver) {
|
|
@@ -2437,17 +2487,18 @@ class AuthImpl {
|
|
|
2437
2487
|
// Have to check for app deletion throughout initialization (after each
|
|
2438
2488
|
// promise resolution)
|
|
2439
2489
|
this._initializationPromise = this.queue(async () => {
|
|
2440
|
-
var _a, _b;
|
|
2490
|
+
var _a, _b, _c;
|
|
2441
2491
|
if (this._deleted) {
|
|
2442
2492
|
return;
|
|
2443
2493
|
}
|
|
2444
2494
|
this.persistenceManager = await PersistenceUserManager.create(this, persistenceHierarchy);
|
|
2495
|
+
(_a = this._resolvePersistenceManagerAvailable) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2445
2496
|
if (this._deleted) {
|
|
2446
2497
|
return;
|
|
2447
2498
|
}
|
|
2448
2499
|
// Initialize the resolver early if necessary (only applicable to web:
|
|
2449
2500
|
// this will cause the iframe to load immediately in certain cases)
|
|
2450
|
-
if ((
|
|
2501
|
+
if ((_b = this._popupRedirectResolver) === null || _b === void 0 ? void 0 : _b._shouldInitProactively) {
|
|
2451
2502
|
// If this fails, don't halt auth loading
|
|
2452
2503
|
try {
|
|
2453
2504
|
await this._popupRedirectResolver._initialize(this);
|
|
@@ -2457,7 +2508,7 @@ class AuthImpl {
|
|
|
2457
2508
|
}
|
|
2458
2509
|
}
|
|
2459
2510
|
await this.initializeCurrentUser(popupRedirectResolver);
|
|
2460
|
-
this.lastNotifiedUid = ((
|
|
2511
|
+
this.lastNotifiedUid = ((_c = this.currentUser) === null || _c === void 0 ? void 0 : _c.uid) || null;
|
|
2461
2512
|
if (this._deleted) {
|
|
2462
2513
|
return;
|
|
2463
2514
|
}
|
|
@@ -2711,9 +2762,12 @@ class AuthImpl {
|
|
|
2711
2762
|
this._tenantPasswordPolicies[this.tenantId] = passwordPolicy;
|
|
2712
2763
|
}
|
|
2713
2764
|
}
|
|
2714
|
-
|
|
2765
|
+
_getPersistenceType() {
|
|
2715
2766
|
return this.assertedPersistence.persistence.type;
|
|
2716
2767
|
}
|
|
2768
|
+
_getPersistence() {
|
|
2769
|
+
return this.assertedPersistence.persistence;
|
|
2770
|
+
}
|
|
2717
2771
|
_updateErrorMap(errorMap) {
|
|
2718
2772
|
this._errorFactory = new ErrorFactory('auth', 'Firebase', errorMap());
|
|
2719
2773
|
}
|
|
@@ -5125,7 +5179,7 @@ class ActionCodeURL {
|
|
|
5125
5179
|
this.operation = operation;
|
|
5126
5180
|
this.code = code;
|
|
5127
5181
|
this.continueUrl = (_d = searchParams["continueUrl" /* QueryField.CONTINUE_URL */]) !== null && _d !== void 0 ? _d : null;
|
|
5128
|
-
this.languageCode = (_e = searchParams["
|
|
5182
|
+
this.languageCode = (_e = searchParams["lang" /* QueryField.LANGUAGE_CODE */]) !== null && _e !== void 0 ? _e : null;
|
|
5129
5183
|
this.tenantId = (_f = searchParams["tenantId" /* QueryField.TENANT_ID */]) !== null && _f !== void 0 ? _f : null;
|
|
5130
5184
|
}
|
|
5131
5185
|
/**
|