@frontegg/rest-api
Advanced tools
Comparing version 3.0.132 to 3.0.133
@@ -12,2 +12,3 @@ export * from "./secutiry-poilicy"; | ||
export declare function generateLoginResponseFromOAuthResponse(oauthResponse: IOAuthTokenResponse): Promise<ILoginResponse>; | ||
export declare function generateLoginResponseFromOAuthResponseV2(oauthResponse: IOAuthTokenResponse): Promise<ILoginResponseV3>; | ||
/** | ||
@@ -47,2 +48,13 @@ * Check if requested email address has sso configuration | ||
/** | ||
* login with username and password. | ||
* if the user has two factor authentication | ||
* the server will return mfaToken with mfaRequired: true, | ||
* and then ``loginWithMfa`` should be called with the mfaToken and and generated code | ||
* else, the server will accessToken and refreshToken. | ||
* the refresh should be used to renew your access token by calling ``refreshToken`` | ||
* | ||
* @throw exception if login failed | ||
*/ | ||
export declare function loginv2(body: ILogin): Promise<ILoginResponseV3>; | ||
/** | ||
* after login succeeded with mfaRequired token response, this function should be called | ||
@@ -55,2 +67,9 @@ * with the mfaToken and the generated code from your authenticator app. | ||
/** | ||
* after login succeeded with mfaRequired token response, this function should be called | ||
* with the mfaToken and the generated code from your authenticator app. | ||
* | ||
* @throw exception if generated code or mfaToken are incorrect | ||
*/ | ||
export declare function loginWithMfaV2(body: ILoginWithMfa): Promise<ILoginResponseV3>; | ||
/** | ||
* activating account should be called after registering new user of deactivate account | ||
@@ -63,2 +82,9 @@ * ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested. | ||
/** | ||
* activating account should be called after registering new user of deactivate account | ||
* ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested. | ||
* | ||
* @throws exception if activation failed | ||
*/ | ||
export declare function activateAccountV2(body: IActivateAccount): Promise<ILoginResponseV3>; | ||
/** | ||
* get account activation configuration. | ||
@@ -247,2 +273,7 @@ */ | ||
/** | ||
* after pre enroll with authenticator app, enroll authenticator app function should be called | ||
* with the generated code in the Authenticator App | ||
*/ | ||
export declare function enrollMFAAuthenticatorAppForLoginV2(body: IEnrollMFAAuthenticatorApp): Promise<ILoginResponseV3>; | ||
/** | ||
* after login succeeded with mfaRequired token response, this function should be called | ||
@@ -263,2 +294,7 @@ * with the selected authenticator app id, mfaToken and the generated code from your authenticator app. | ||
/** | ||
* after pre verify with Email Code, verify Email Code function should be called | ||
* with the otcToken and the code that has been sent to the email | ||
*/ | ||
export declare function verifyMFAEmailCodeV2(body: IVerifyMFAEmailCode): Promise<ILoginResponseV3>; | ||
/** | ||
* pre enroll Multi-Factor to use with SMS | ||
@@ -275,2 +311,7 @@ * the server returns otcToken that should be sent to the enroll function with the code that was sent to | ||
/** | ||
* after pre enroll with SMS, enroll SMS function should be called | ||
* with the otcToken and the code that has been sent to the phone number that was requested | ||
*/ | ||
export declare function enrollMFASMSForLoginV2(body: IEnrollMFASMS): Promise<ILoginResponseV3>; | ||
/** | ||
* after login succeeded with mfaRequired token response, if the user asked to use SMS as MFA | ||
@@ -286,2 +327,7 @@ * this function should be called with the selected device id and mfaToken | ||
/** | ||
* after pre verify with SMS, this function should be called with otcToken, mfaToken and the code | ||
* that has been sent to the selected device. | ||
*/ | ||
export declare function verifyMFASMSForLoginV2(deviceId: string, body: IVerifyMFASMS): Promise<ILoginResponseV3>; | ||
/** | ||
* pre enroll Multi-Factor to use with WebAuthn | ||
@@ -298,2 +344,7 @@ * the server returns attestation object | ||
/** | ||
* after pre enroll with WebAuthn, enroll WebAuthn function should be called | ||
* with the webauthnToken and the attestation object response | ||
*/ | ||
export declare function enrollMFAWebAuthnForLoginV2(body: IEnrollMFAWebAuthn): Promise<ILoginResponseV3>; | ||
/** | ||
* after login succeeded with mfaRequired token response, if the user asked to use WebAuthn as MFA | ||
@@ -515,2 +566,3 @@ * this function should be called with the selected device id and mfaToken. | ||
export declare function passwordlessPreLogin({ type, ...body }: IPasswordlessPreLogin): Promise<void>; | ||
export declare function passwordlessPostLoginV2({ type, ...body }: IPasswordlessPostLogin): Promise<ILoginResponseV3>; | ||
export declare function passwordlessPostLogin({ type, ...body }: IPasswordlessPostLogin): Promise<ILoginResponse>; | ||
@@ -620,2 +672,4 @@ /** | ||
export declare function oidcPostLoginV2(body: IOidcPostLoginV2): Promise<ILoginResponse>; | ||
export declare function exchangeOAuthTokensV2(body: IExchangeOAuthTokens): Promise<ILoginResponseV3>; | ||
export declare function silentOAuthRefreshTokenV2(): Promise<ILoginResponseV3>; | ||
export declare function exchangeOAuthTokens(body: IExchangeOAuthTokens): Promise<ILoginResponse>; | ||
@@ -654,2 +708,6 @@ export declare function silentOAuthRefreshToken(): Promise<ILoginResponse>; | ||
/** | ||
* webauthn postlogin should be called after the user used his authenticator (device/android/usb key) in order to login | ||
*/ | ||
export declare function webAuthnPostLoginV2(body: IWebAuthnPostLogin): Promise<ILoginResponseV3>; | ||
/** | ||
* webauthn create new device should be called once the user wants to add new device as authenticator | ||
@@ -656,0 +714,0 @@ */ |
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
const _excluded = ["type"], | ||
_excluded2 = ["type"]; | ||
_excluded2 = ["type"], | ||
_excluded3 = ["type"]; | ||
import { getTenants } from "../tenants"; | ||
@@ -82,2 +83,22 @@ export * from "./secutiry-poilicy"; | ||
} | ||
export async function generateLoginResponseFromOAuthResponseV2(oauthResponse) { | ||
ContextHolder.setAccessToken(oauthResponse.id_token); | ||
const [me, currentUserTenants] = await Promise.all([Get(`${urls.identity.users.v2}/me`), getCurrentUserTenantsV3()]); | ||
const decodedContent = oauthResponse.id_token ? jwtDecode(oauthResponse.id_token) : {}; | ||
const user = _extends({ | ||
mfaRequired: false, | ||
accessToken: oauthResponse.id_token, | ||
refreshToken: oauthResponse.refresh_token | ||
}, decodedContent, me, { | ||
expiresIn: oauthResponse.expires_in || 300 | ||
}); | ||
ContextHolder.setUser(user); | ||
return { | ||
user, | ||
tenants: currentUserTenants.tenants, | ||
activeTenant: currentUserTenants.activeTenant | ||
}; | ||
} | ||
export async function preLogin(body) { | ||
@@ -108,2 +129,6 @@ try { | ||
} | ||
export async function loginv2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function loginWithMfa(body) { | ||
@@ -113,5 +138,13 @@ const data = await Post(`${urls.identity.auth.v1}/user/mfa/verify`, body); | ||
} | ||
export async function loginWithMfaV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function activateAccount(body) { | ||
return Post(`${urls.identity.users.v1}/activate`, body); | ||
} | ||
export async function activateAccountV2(body) { | ||
const data = await Post(`${urls.identity.users.v1}/activate`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function getActivateAccountStrategy(params) { | ||
@@ -210,2 +243,6 @@ return Get(`${urls.identity.users.v1}/activate/strategy`, params); | ||
} | ||
export async function enrollMFAAuthenticatorAppForLoginV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function verifyMFAAuthenticatorAppForLogin(deviceId, body) { | ||
@@ -220,2 +257,6 @@ return Post(`${urls.identity.auth.v1}/user/mfa/authenticator/${deviceId}/verify`, body); | ||
} | ||
export async function verifyMFAEmailCodeV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/emailcode/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function preEnrollMFASMSForLogin(body) { | ||
@@ -227,2 +268,6 @@ return Post(`${urls.identity.auth.v1}/user/mfa/sms/enroll`, body); | ||
} | ||
export async function enrollMFASMSForLoginV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function preVerifyMFASMSForLogin(deviceId, body) { | ||
@@ -234,2 +279,6 @@ return Post(`${urls.identity.auth.v1}/user/mfa/sms/${deviceId}`, body); | ||
} | ||
export async function verifyMFASMSForLoginV2(deviceId, body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function preEnrollMFAWebAuthnForLogin(body) { | ||
@@ -241,2 +290,6 @@ return Post(`${urls.identity.auth.v1}/user/mfa/webauthn/enroll`, body); | ||
} | ||
export async function enrollMFAWebAuthnForLoginV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function preVerifyMFAWebAuthnForLogin(deviceId, body) { | ||
@@ -367,9 +420,22 @@ return Post(`${urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}`, body); | ||
} = await Post(`${urls.identity.users.v1}/signUp`, body); | ||
const loginResponse = !shouldActivate && authResponse ? await generateLoginResponse(authResponse) : undefined; | ||
return { | ||
const response = { | ||
shouldActivate, | ||
user: loginResponse, | ||
userId, | ||
tenantId | ||
}; | ||
if (!shouldActivate && authResponse) { | ||
const { | ||
user, | ||
tenants, | ||
activeTenant | ||
} = await generateLoginResponseV3(authResponse); | ||
return _extends({}, response, { | ||
user, | ||
tenants, | ||
activeTenant | ||
}); | ||
} | ||
return response; | ||
} | ||
@@ -461,3 +527,3 @@ export async function getCurrentUserSessions() { | ||
} | ||
export async function passwordlessPostLogin(_ref2) { | ||
export async function passwordlessPostLoginV2(_ref2) { | ||
let { | ||
@@ -468,2 +534,11 @@ type | ||
const data = await Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function passwordlessPostLogin(_ref3) { | ||
let { | ||
type | ||
} = _ref3, | ||
body = _objectWithoutPropertiesLoose(_ref3, _excluded3); | ||
return Post(`${urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body); | ||
@@ -537,2 +612,10 @@ } | ||
} | ||
export async function exchangeOAuthTokensV2(body) { | ||
const data = await Post(`${urls.oauth.v1}/token`, body); | ||
return generateLoginResponseFromOAuthResponseV2(data); | ||
} | ||
export async function silentOAuthRefreshTokenV2() { | ||
const data = await Post(`${urls.oauth.v1}/authorize/silent`); | ||
return generateLoginResponseFromOAuthResponseV2(data); | ||
} | ||
export async function exchangeOAuthTokens(body) { | ||
@@ -567,2 +650,6 @@ const data = await Post(`${urls.oauth.v1}/token`, body); | ||
} | ||
export async function webAuthnPostLoginV2(body) { | ||
const data = await Post(`${urls.identity.auth.v1}/webauthn/postlogin`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
export async function webAuthnCreateNewDeviceSession() { | ||
@@ -569,0 +656,0 @@ return Post(urls.identity.webAuthnDevices.v1); |
@@ -222,2 +222,4 @@ import { ITenantsResponse, IUserProfile } from ".."; | ||
tenantId?: string; | ||
tenants?: ITenantsResponse[]; | ||
activeTenant?: ITenantsResponse; | ||
} | ||
@@ -224,0 +226,0 @@ export interface ISessionResponse { |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v3.0.132 | ||
/** @license Frontegg v3.0.133 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
@@ -13,2 +13,3 @@ "use strict"; | ||
generateLoginResponseFromOAuthResponse: true, | ||
generateLoginResponseFromOAuthResponseV2: true, | ||
preLogin: true, | ||
@@ -19,4 +20,7 @@ preLoginWithIdpType: true, | ||
login: true, | ||
loginv2: true, | ||
loginWithMfa: true, | ||
loginWithMfaV2: true, | ||
activateAccount: true, | ||
activateAccountV2: true, | ||
getActivateAccountStrategy: true, | ||
@@ -52,11 +56,16 @@ resendActivationEmail: true, | ||
enrollMFAAuthenticatorAppForLogin: true, | ||
enrollMFAAuthenticatorAppForLoginV2: true, | ||
verifyMFAAuthenticatorAppForLogin: true, | ||
preVerifyMFAEmailCode: true, | ||
verifyMFAEmailCode: true, | ||
verifyMFAEmailCodeV2: true, | ||
preEnrollMFASMSForLogin: true, | ||
enrollMFASMSForLogin: true, | ||
enrollMFASMSForLoginV2: true, | ||
preVerifyMFASMSForLogin: true, | ||
verifyMFASMSForLogin: true, | ||
verifyMFASMSForLoginV2: true, | ||
preEnrollMFAWebAuthnForLogin: true, | ||
enrollMFAWebAuthnForLogin: true, | ||
enrollMFAWebAuthnForLoginV2: true, | ||
preVerifyMFAWebAuthnForLogin: true, | ||
@@ -106,2 +115,3 @@ verifyMFAWebAuthnForLogin: true, | ||
passwordlessPreLogin: true, | ||
passwordlessPostLoginV2: true, | ||
passwordlessPostLogin: true, | ||
@@ -126,2 +136,4 @@ verifyInviteToken: true, | ||
oidcPostLoginV2: true, | ||
exchangeOAuthTokensV2: true, | ||
silentOAuthRefreshTokenV2: true, | ||
exchangeOAuthTokens: true, | ||
@@ -136,2 +148,3 @@ silentOAuthRefreshToken: true, | ||
webAuthnPostLogin: true, | ||
webAuthnPostLoginV2: true, | ||
webAuthnCreateNewDeviceSession: true, | ||
@@ -148,2 +161,3 @@ getWebAuthnDevices: true, | ||
exports.activateAccount = activateAccount; | ||
exports.activateAccountV2 = activateAccountV2; | ||
exports.changePhoneNumber = changePhoneNumber; | ||
@@ -177,11 +191,16 @@ exports.changePhoneNumberWithVerification = changePhoneNumberWithVerification; | ||
exports.enrollMFAAuthenticatorAppForLogin = enrollMFAAuthenticatorAppForLogin; | ||
exports.enrollMFAAuthenticatorAppForLoginV2 = enrollMFAAuthenticatorAppForLoginV2; | ||
exports.enrollMFASMS = enrollMFASMS; | ||
exports.enrollMFASMSForLogin = enrollMFASMSForLogin; | ||
exports.enrollMFASMSForLoginV2 = enrollMFASMSForLoginV2; | ||
exports.enrollMFAWebAuthn = enrollMFAWebAuthn; | ||
exports.enrollMFAWebAuthnForLogin = enrollMFAWebAuthnForLogin; | ||
exports.enrollMFAWebAuthnForLoginV2 = enrollMFAWebAuthnForLoginV2; | ||
exports.enrollMfa = enrollMfa; | ||
exports.exchangeOAuthTokens = exchangeOAuthTokens; | ||
exports.exchangeOAuthTokensV2 = exchangeOAuthTokensV2; | ||
exports.forgotPassword = forgotPassword; | ||
exports.generateLoginResponse = generateLoginResponse; | ||
exports.generateLoginResponseFromOAuthResponse = generateLoginResponseFromOAuthResponse; | ||
exports.generateLoginResponseFromOAuthResponseV2 = generateLoginResponseFromOAuthResponseV2; | ||
exports.generateLoginResponseV2 = generateLoginResponseV2; | ||
@@ -221,2 +240,4 @@ exports.generateLoginResponseV3 = generateLoginResponseV3; | ||
exports.loginWithMfa = loginWithMfa; | ||
exports.loginWithMfaV2 = loginWithMfaV2; | ||
exports.loginv2 = loginv2; | ||
exports.logout = logout; | ||
@@ -226,2 +247,3 @@ exports.oidcPostLogin = oidcPostLogin; | ||
exports.passwordlessPostLogin = passwordlessPostLogin; | ||
exports.passwordlessPostLoginV2 = passwordlessPostLoginV2; | ||
exports.passwordlessPreLogin = passwordlessPreLogin; | ||
@@ -255,2 +277,3 @@ exports.postLogin = postLogin; | ||
exports.silentOAuthRefreshToken = silentOAuthRefreshToken; | ||
exports.silentOAuthRefreshTokenV2 = silentOAuthRefreshTokenV2; | ||
exports.updateSSOConfiguration = updateSSOConfiguration; | ||
@@ -271,3 +294,5 @@ exports.updateSSOConfigurationByMetadata = updateSSOConfigurationByMetadata; | ||
exports.verifyMFAEmailCode = verifyMFAEmailCode; | ||
exports.verifyMFAEmailCodeV2 = verifyMFAEmailCodeV2; | ||
exports.verifyMFASMSForLogin = verifyMFASMSForLogin; | ||
exports.verifyMFASMSForLoginV2 = verifyMFASMSForLoginV2; | ||
exports.verifyMFAWebAuthnForLogin = verifyMFAWebAuthnForLogin; | ||
@@ -279,2 +304,3 @@ exports.verifyMfa = verifyMfa; | ||
exports.webAuthnPostLogin = webAuthnPostLogin; | ||
exports.webAuthnPostLoginV2 = webAuthnPostLoginV2; | ||
exports.webAuthnPreLogin = webAuthnPreLogin; | ||
@@ -327,3 +353,4 @@ | ||
const _excluded = ["type"], | ||
_excluded2 = ["type"]; | ||
_excluded2 = ["type"], | ||
_excluded3 = ["type"]; | ||
@@ -407,2 +434,24 @@ async function generateLoginResponse(loginResponse) { | ||
async function generateLoginResponseFromOAuthResponseV2(oauthResponse) { | ||
_ContextHolder.ContextHolder.setAccessToken(oauthResponse.id_token); | ||
const [me, currentUserTenants] = await Promise.all([(0, _fetch.Get)(`${_constants.urls.identity.users.v2}/me`), (0, _users.getCurrentUserTenantsV3)()]); | ||
const decodedContent = oauthResponse.id_token ? (0, _jwt.jwtDecode)(oauthResponse.id_token) : {}; | ||
const user = (0, _extends2.default)({ | ||
mfaRequired: false, | ||
accessToken: oauthResponse.id_token, | ||
refreshToken: oauthResponse.refresh_token | ||
}, decodedContent, me, { | ||
expiresIn: oauthResponse.expires_in || 300 | ||
}); | ||
_ContextHolder.ContextHolder.setUser(user); | ||
return { | ||
user, | ||
tenants: currentUserTenants.tenants, | ||
activeTenant: currentUserTenants.activeTenant | ||
}; | ||
} | ||
async function preLogin(body) { | ||
@@ -438,2 +487,7 @@ try { | ||
async function loginv2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function loginWithMfa(body) { | ||
@@ -444,2 +498,7 @@ const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/verify`, body); | ||
async function loginWithMfaV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function activateAccount(body) { | ||
@@ -449,2 +508,7 @@ return (0, _fetch.Post)(`${_constants.urls.identity.users.v1}/activate`, body); | ||
async function activateAccountV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.users.v1}/activate`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function getActivateAccountStrategy(params) { | ||
@@ -573,2 +637,7 @@ return (0, _fetch.Get)(`${_constants.urls.identity.users.v1}/activate/strategy`, params); | ||
async function enrollMFAAuthenticatorAppForLoginV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/authenticator/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function verifyMFAAuthenticatorAppForLogin(deviceId, body) { | ||
@@ -586,2 +655,7 @@ return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/authenticator/${deviceId}/verify`, body); | ||
async function verifyMFAEmailCodeV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/emailcode/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function preEnrollMFASMSForLogin(body) { | ||
@@ -595,2 +669,7 @@ return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/sms/enroll`, body); | ||
async function enrollMFASMSForLoginV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/sms/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function preVerifyMFASMSForLogin(deviceId, body) { | ||
@@ -604,2 +683,7 @@ return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/sms/${deviceId}`, body); | ||
async function verifyMFASMSForLoginV2(deviceId, body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/sms/${deviceId}/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function preEnrollMFAWebAuthnForLogin(body) { | ||
@@ -613,2 +697,7 @@ return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/webauthn/enroll`, body); | ||
async function enrollMFAWebAuthnForLoginV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/webauthn/enroll/verify`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function preVerifyMFAWebAuthnForLogin(deviceId, body) { | ||
@@ -760,9 +849,22 @@ return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/user/mfa/webauthn/${deviceId}`, body); | ||
} = await (0, _fetch.Post)(`${_constants.urls.identity.users.v1}/signUp`, body); | ||
const loginResponse = !shouldActivate && authResponse ? await generateLoginResponse(authResponse) : undefined; | ||
return { | ||
const response = { | ||
shouldActivate, | ||
user: loginResponse, | ||
userId, | ||
tenantId | ||
}; | ||
if (!shouldActivate && authResponse) { | ||
const { | ||
user, | ||
tenants, | ||
activeTenant | ||
} = await generateLoginResponseV3(authResponse); | ||
return (0, _extends2.default)({}, response, { | ||
user, | ||
tenants, | ||
activeTenant | ||
}); | ||
} | ||
return response; | ||
} | ||
@@ -876,3 +978,3 @@ | ||
async function passwordlessPostLogin(_ref2) { | ||
async function passwordlessPostLoginV2(_ref2) { | ||
let { | ||
@@ -882,2 +984,11 @@ type | ||
body = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2); | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function passwordlessPostLogin(_ref3) { | ||
let { | ||
type | ||
} = _ref3, | ||
body = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3); | ||
return (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/passwordless/${type.toLocaleLowerCase()}/postlogin`, body); | ||
@@ -970,2 +1081,12 @@ } | ||
async function exchangeOAuthTokensV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.oauth.v1}/token`, body); | ||
return generateLoginResponseFromOAuthResponseV2(data); | ||
} | ||
async function silentOAuthRefreshTokenV2() { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.oauth.v1}/authorize/silent`); | ||
return generateLoginResponseFromOAuthResponseV2(data); | ||
} | ||
async function exchangeOAuthTokens(body) { | ||
@@ -1009,2 +1130,7 @@ const data = await (0, _fetch.Post)(`${_constants.urls.oauth.v1}/token`, body); | ||
async function webAuthnPostLoginV2(body) { | ||
const data = await (0, _fetch.Post)(`${_constants.urls.identity.auth.v1}/webauthn/postlogin`, body); | ||
return generateLoginResponseV3(data); | ||
} | ||
async function webAuthnCreateNewDeviceSession() { | ||
@@ -1011,0 +1137,0 @@ return (0, _fetch.Post)(_constants.urls.identity.webAuthnDevices.v1); |
@@ -1,2 +0,2 @@ | ||
/** @license Frontegg v3.0.132 | ||
/** @license Frontegg v3.0.133 | ||
* | ||
@@ -3,0 +3,0 @@ * This source code is licensed under the MIT license found in the |
{ | ||
"name": "@frontegg/rest-api", | ||
"version": "3.0.132", | ||
"version": "3.0.133", | ||
"main": "./node/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
360710
9965