@firebase/auth 1.3.0-canary.0ae010ef2 → 1.3.0-canary.12f25592c
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/browser-cjs/{index-77c7acd1.js → index-b8d969af.js} +28 -82
- package/dist/browser-cjs/index-b8d969af.js.map +1 -0
- package/dist/browser-cjs/index.js +1 -1
- package/dist/browser-cjs/internal.js +1 -1
- package/dist/browser-cjs/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/cordova/index.js +2 -2
- package/dist/cordova/internal.js +2 -2
- package/dist/cordova/{popup_redirect-378dee5d.js → popup_redirect-5e5f5325.js} +76 -166
- package/dist/cordova/popup_redirect-5e5f5325.js.map +1 -0
- package/dist/cordova/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm2017/{index-8ae48e33.js → index-d416518f.js} +28 -82
- package/dist/esm2017/index-d416518f.js.map +1 -0
- package/dist/esm2017/index.js +1 -1
- package/dist/esm2017/internal.js +2 -2
- package/dist/esm2017/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/esm5/{index-24e45e55.js → index-3f5e864f.js} +76 -166
- package/dist/esm5/index-3f5e864f.js.map +1 -0
- package/dist/esm5/index.js +1 -1
- package/dist/esm5/internal.js +2 -2
- package/dist/esm5/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/index.webworker.esm5.js +75 -165
- package/dist/index.webworker.esm5.js.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal.js +1 -1
- package/dist/node/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node/{totp-55649440.js → totp-1d922ce9.js} +76 -166
- package/dist/node/totp-1d922ce9.js.map +1 -0
- package/dist/node-esm/index.js +1 -1
- package/dist/node-esm/internal.js +2 -2
- package/dist/node-esm/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/node-esm/{totp-4aedda59.js → totp-ab4fe73d.js} +28 -82
- package/dist/node-esm/totp-ab4fe73d.js.map +1 -0
- package/dist/rn/{index-dad0301e.js → index-81668c87.js} +76 -166
- package/dist/rn/index-81668c87.js.map +1 -0
- package/dist/rn/index.js +1 -1
- package/dist/rn/internal.js +1 -1
- package/dist/rn/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/dist/src/platform_browser/recaptcha/recaptcha_enterprise_verifier.d.ts +3 -0
- package/package.json +6 -6
- package/dist/browser-cjs/index-77c7acd1.js.map +0 -1
- package/dist/cordova/popup_redirect-378dee5d.js.map +0 -1
- package/dist/esm2017/index-8ae48e33.js.map +0 -1
- package/dist/esm5/index-24e45e55.js.map +0 -1
- package/dist/node/totp-55649440.js.map +0 -1
- package/dist/node-esm/totp-4aedda59.js.map +0 -1
- package/dist/rn/index-dad0301e.js.map +0 -1
|
@@ -39,4 +39,7 @@ export declare class RecaptchaEnterpriseVerifier {
|
|
|
39
39
|
verify(action?: string, forceRefresh?: boolean): Promise<string>;
|
|
40
40
|
}
|
|
41
41
|
export declare function injectRecaptchaFields<T>(auth: AuthInternal, request: T, action: RecaptchaActionName, captchaResp?: boolean): Promise<T>;
|
|
42
|
+
declare type ActionMethod<TRequest, TResponse> = (auth: Auth, request: TRequest) => Promise<TResponse>;
|
|
43
|
+
export declare function handleRecaptchaFlow<TRequest, TResponse>(authInstance: AuthInternal, request: TRequest, actionName: RecaptchaActionName, actionMethod: ActionMethod<TRequest, TResponse>): Promise<TResponse>;
|
|
42
44
|
export declare function _initializeRecaptchaConfig(auth: Auth): Promise<void>;
|
|
45
|
+
export {};
|
|
@@ -3133,6 +3133,25 @@ async function injectRecaptchaFields(auth, request, action, captchaResp = false)
|
|
|
3133
3133
|
});
|
|
3134
3134
|
return newRequest;
|
|
3135
3135
|
}
|
|
3136
|
+
async function handleRecaptchaFlow(authInstance, request, actionName, actionMethod) {
|
|
3137
|
+
var _a;
|
|
3138
|
+
if ((_a = authInstance._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
|
|
3139
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3140
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3141
|
+
}
|
|
3142
|
+
else {
|
|
3143
|
+
return actionMethod(authInstance, request).catch(async (error) => {
|
|
3144
|
+
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
3145
|
+
console.log(`${actionName} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);
|
|
3146
|
+
const requestWithRecaptcha = await injectRecaptchaFields(authInstance, request, actionName, actionName === "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */);
|
|
3147
|
+
return actionMethod(authInstance, requestWithRecaptcha);
|
|
3148
|
+
}
|
|
3149
|
+
else {
|
|
3150
|
+
return Promise.reject(error);
|
|
3151
|
+
}
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3136
3155
|
async function _initializeRecaptchaConfig(auth) {
|
|
3137
3156
|
const authInternal = _castAuth(auth);
|
|
3138
3157
|
const response = await getRecaptchaConfig(authInternal, {
|
|
@@ -3559,7 +3578,6 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3559
3578
|
}
|
|
3560
3579
|
/** @internal */
|
|
3561
3580
|
async _getIdTokenResponse(auth) {
|
|
3562
|
-
var _a;
|
|
3563
3581
|
switch (this.signInMethod) {
|
|
3564
3582
|
case "password" /* SignInMethod.EMAIL_PASSWORD */:
|
|
3565
3583
|
const request = {
|
|
@@ -3568,22 +3586,7 @@ class EmailAuthCredential extends AuthCredential {
|
|
|
3568
3586
|
password: this._password,
|
|
3569
3587
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
3570
3588
|
};
|
|
3571
|
-
|
|
3572
|
-
const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
|
|
3573
|
-
return signInWithPassword(auth, requestWithRecaptcha);
|
|
3574
|
-
}
|
|
3575
|
-
else {
|
|
3576
|
-
return signInWithPassword(auth, request).catch(async (error) => {
|
|
3577
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
3578
|
-
console.log('Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
3579
|
-
const requestWithRecaptcha = await injectRecaptchaFields(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */);
|
|
3580
|
-
return signInWithPassword(auth, requestWithRecaptcha);
|
|
3581
|
-
}
|
|
3582
|
-
else {
|
|
3583
|
-
return Promise.reject(error);
|
|
3584
|
-
}
|
|
3585
|
-
});
|
|
3586
|
-
}
|
|
3589
|
+
return handleRecaptchaFlow(auth, request, "signInWithPassword" /* RecaptchaActionName.SIGN_IN_WITH_PASSWORD */, signInWithPassword);
|
|
3587
3590
|
case "emailLink" /* SignInMethod.EMAIL_LINK */:
|
|
3588
3591
|
return signInWithEmailLink$1(auth, {
|
|
3589
3592
|
email: this._email,
|
|
@@ -5561,39 +5564,16 @@ async function recachePasswordPolicy(auth) {
|
|
|
5561
5564
|
* @public
|
|
5562
5565
|
*/
|
|
5563
5566
|
async function sendPasswordResetEmail(auth, email, actionCodeSettings) {
|
|
5564
|
-
var _a;
|
|
5565
5567
|
const authInternal = _castAuth(auth);
|
|
5566
5568
|
const request = {
|
|
5567
5569
|
requestType: "PASSWORD_RESET" /* ActionCodeOperation.PASSWORD_RESET */,
|
|
5568
5570
|
email,
|
|
5569
5571
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5570
5572
|
};
|
|
5571
|
-
if (
|
|
5572
|
-
|
|
5573
|
-
if (actionCodeSettings) {
|
|
5574
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
5575
|
-
}
|
|
5576
|
-
await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
|
|
5577
|
-
}
|
|
5578
|
-
else {
|
|
5579
|
-
if (actionCodeSettings) {
|
|
5580
|
-
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5581
|
-
}
|
|
5582
|
-
await sendPasswordResetEmail$1(authInternal, request)
|
|
5583
|
-
.catch(async (error) => {
|
|
5584
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5585
|
-
console.log('Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.');
|
|
5586
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
|
|
5587
|
-
if (actionCodeSettings) {
|
|
5588
|
-
_setActionCodeSettingsOnRequest(authInternal, requestWithRecaptcha, actionCodeSettings);
|
|
5589
|
-
}
|
|
5590
|
-
await sendPasswordResetEmail$1(authInternal, requestWithRecaptcha);
|
|
5591
|
-
}
|
|
5592
|
-
else {
|
|
5593
|
-
return Promise.reject(error);
|
|
5594
|
-
}
|
|
5595
|
-
});
|
|
5573
|
+
if (actionCodeSettings) {
|
|
5574
|
+
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5596
5575
|
}
|
|
5576
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendPasswordResetEmail$1);
|
|
5597
5577
|
}
|
|
5598
5578
|
/**
|
|
5599
5579
|
* Completes the password reset process, given a confirmation code and new password.
|
|
@@ -5713,7 +5693,6 @@ async function verifyPasswordResetCode(auth, code) {
|
|
|
5713
5693
|
* @public
|
|
5714
5694
|
*/
|
|
5715
5695
|
async function createUserWithEmailAndPassword(auth, email, password) {
|
|
5716
|
-
var _a;
|
|
5717
5696
|
const authInternal = _castAuth(auth);
|
|
5718
5697
|
const request = {
|
|
5719
5698
|
returnSecureToken: true,
|
|
@@ -5721,21 +5700,7 @@ async function createUserWithEmailAndPassword(auth, email, password) {
|
|
|
5721
5700
|
password,
|
|
5722
5701
|
clientType: "CLIENT_TYPE_WEB" /* RecaptchaClientType.WEB */
|
|
5723
5702
|
};
|
|
5724
|
-
|
|
5725
|
-
if ((_a = authInternal._getRecaptchaConfig()) === null || _a === void 0 ? void 0 : _a.emailPasswordEnabled) {
|
|
5726
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
|
|
5727
|
-
signUpResponse = signUp(authInternal, requestWithRecaptcha);
|
|
5728
|
-
}
|
|
5729
|
-
else {
|
|
5730
|
-
signUpResponse = signUp(authInternal, request).catch(async (error) => {
|
|
5731
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5732
|
-
console.log('Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.');
|
|
5733
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */);
|
|
5734
|
-
return signUp(authInternal, requestWithRecaptcha);
|
|
5735
|
-
}
|
|
5736
|
-
throw error;
|
|
5737
|
-
});
|
|
5738
|
-
}
|
|
5703
|
+
const signUpResponse = handleRecaptchaFlow(authInternal, request, "signUpPassword" /* RecaptchaActionName.SIGN_UP_PASSWORD */, signUp);
|
|
5739
5704
|
const response = await signUpResponse.catch(error => {
|
|
5740
5705
|
if (error.code === `auth/${"password-does-not-meet-requirements" /* AuthErrorCode.PASSWORD_DOES_NOT_MEET_REQUIREMENTS */}`) {
|
|
5741
5706
|
void recachePasswordPolicy(auth);
|
|
@@ -5826,7 +5791,6 @@ function signInWithEmailAndPassword(auth, email, password) {
|
|
|
5826
5791
|
* @public
|
|
5827
5792
|
*/
|
|
5828
5793
|
async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
5829
|
-
var _a;
|
|
5830
5794
|
const authInternal = _castAuth(auth);
|
|
5831
5795
|
const request = {
|
|
5832
5796
|
requestType: "EMAIL_SIGNIN" /* ActionCodeOperation.EMAIL_SIGNIN */,
|
|
@@ -5839,26 +5803,8 @@ async function sendSignInLinkToEmail(auth, email, actionCodeSettings) {
|
|
|
5839
5803
|
_setActionCodeSettingsOnRequest(authInternal, request, actionCodeSettings);
|
|
5840
5804
|
}
|
|
5841
5805
|
}
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
5845
|
-
await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
|
|
5846
|
-
}
|
|
5847
|
-
else {
|
|
5848
|
-
setActionCodeSettings(request, actionCodeSettings);
|
|
5849
|
-
await sendSignInLinkToEmail$1(authInternal, request)
|
|
5850
|
-
.catch(async (error) => {
|
|
5851
|
-
if (error.code === `auth/${"missing-recaptcha-token" /* AuthErrorCode.MISSING_RECAPTCHA_TOKEN */}`) {
|
|
5852
|
-
console.log('Email link sign-in is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.');
|
|
5853
|
-
const requestWithRecaptcha = await injectRecaptchaFields(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, true);
|
|
5854
|
-
setActionCodeSettings(requestWithRecaptcha, actionCodeSettings);
|
|
5855
|
-
await sendSignInLinkToEmail$1(authInternal, requestWithRecaptcha);
|
|
5856
|
-
}
|
|
5857
|
-
else {
|
|
5858
|
-
return Promise.reject(error);
|
|
5859
|
-
}
|
|
5860
|
-
});
|
|
5861
|
-
}
|
|
5806
|
+
setActionCodeSettings(request, actionCodeSettings);
|
|
5807
|
+
await handleRecaptchaFlow(authInternal, request, "getOobCode" /* RecaptchaActionName.GET_OOB_CODE */, sendSignInLinkToEmail$1);
|
|
5862
5808
|
}
|
|
5863
5809
|
/**
|
|
5864
5810
|
* Checks if an incoming link is a sign-in with email link suitable for {@link signInWithEmailLink}.
|
|
@@ -10218,7 +10164,7 @@ function _isEmptyString(input) {
|
|
|
10218
10164
|
}
|
|
10219
10165
|
|
|
10220
10166
|
var name = "@firebase/auth";
|
|
10221
|
-
var version = "1.3.0-canary.
|
|
10167
|
+
var version = "1.3.0-canary.12f25592c";
|
|
10222
10168
|
|
|
10223
10169
|
/**
|
|
10224
10170
|
* @license
|
|
@@ -10439,4 +10385,4 @@ function getAuth(app = getApp()) {
|
|
|
10439
10385
|
registerAuth("Browser" /* ClientPlatform.BROWSER */);
|
|
10440
10386
|
|
|
10441
10387
|
export { signInAnonymously as $, ActionCodeOperation as A, updateCurrentUser as B, signOut as C, deleteUser as D, debugErrorMap as E, FactorId as F, prodErrorMap as G, AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY as H, initializeAuth as I, connectAuthEmulator as J, AuthCredential as K, EmailAuthCredential as L, OAuthCredential as M, PhoneAuthCredential as N, OperationType as O, PhoneAuthProvider as P, inMemoryPersistence as Q, RecaptchaVerifier as R, SignInMethod as S, TotpMultiFactorGenerator as T, EmailAuthProvider as U, FacebookAuthProvider as V, GoogleAuthProvider as W, GithubAuthProvider as X, OAuthProvider as Y, SAMLAuthProvider as Z, TwitterAuthProvider as _, browserSessionPersistence as a, signInWithCredential as a0, linkWithCredential as a1, reauthenticateWithCredential as a2, signInWithCustomToken as a3, sendPasswordResetEmail as a4, confirmPasswordReset as a5, applyActionCode as a6, checkActionCode as a7, verifyPasswordResetCode as a8, createUserWithEmailAndPassword as a9, _createError as aA, _assert as aB, AuthEventManager as aC, _getInstance as aD, _persistenceKeyName as aE, _getRedirectResult as aF, _overrideRedirectResult as aG, _clearRedirectOutcomes as aH, _castAuth as aI, UserImpl as aJ, AuthImpl as aK, _getClientVersion as aL, _generateEventId as aM, AuthPopup as aN, FetchProvider as aO, SAMLAuthCredential as aP, signInWithEmailAndPassword as aa, sendSignInLinkToEmail as ab, isSignInWithEmailLink as ac, signInWithEmailLink as ad, fetchSignInMethodsForEmail as ae, sendEmailVerification as af, verifyBeforeUpdateEmail as ag, ActionCodeURL as ah, parseActionCodeURL as ai, updateProfile as aj, updateEmail as ak, updatePassword as al, getIdToken as am, getIdTokenResult as an, unlink as ao, getAdditionalUserInfo as ap, reload as aq, getMultiFactorResolver as ar, multiFactor as as, debugAssert as at, _isIOS as au, _isAndroid as av, _fail as aw, _getRedirectUrl as ax, _getProjectConfig as ay, _isIOS7Or8 as az, browserLocalPersistence as b, signInWithPopup as c, linkWithPopup as d, reauthenticateWithPopup as e, signInWithRedirect as f, linkWithRedirect as g, reauthenticateWithRedirect as h, indexedDBLocalPersistence as i, getRedirectResult as j, browserPopupRedirectResolver as k, linkWithPhoneNumber as l, PhoneMultiFactorGenerator as m, TotpSecret as n, getAuth as o, ProviderId as p, setPersistence as q, reauthenticateWithPhoneNumber as r, signInWithPhoneNumber as s, initializeRecaptchaConfig as t, updatePhoneNumber as u, validatePassword as v, onIdTokenChanged as w, beforeAuthStateChanged as x, onAuthStateChanged as y, useDeviceLanguage as z };
|
|
10442
|
-
//# sourceMappingURL=index-
|
|
10388
|
+
//# sourceMappingURL=index-d416518f.js.map
|