@frontegg/rest-api 3.2.1 → 3.2.2

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/auth/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export * from "./enums";
3
3
  export { FRONTEGG_SEPARATE_TABS_BY_TENANT } from "./constants";
4
4
  export { setTabTenantInSessionStorage, getTabTenantFromSessionStorage, getCurrentUserTenantsFunction, removeTabTenantFromSessionStorage } from './utils';
5
5
  import { ISamlRolesGroup } from "../teams/interfaces";
6
- import { IAcceptInvitation, IActivateAccount, IAllowedToRememberMfaDevice, ICreateSamlGroup, IDeleteApiToken, IDisableMfa, IEnrollMfaResponse, IForgotPassword, IGetActivateAccountStrategy, IGetActivateAccountStrategyResponse, IGetUserById, IGetUserPasswordConfig, ILogin, ILoginResponse, ILoginViaSocialLogin, ILoginViaSocialLoginResponse, ILoginWithMfa, IOidcPostLogin, IOidcConfiguration, IPostLogin, IPreLogin, IRecoverMFAToken, IResendActivationEmail, IResetPassword, ISamlConfiguration, ISamlVendorConfigResponse, ISignUpResponse, ISignUpUser, ISocialLoginProviderConfiguration, ITenantApiTokensData, IUpdateSamlConfiguration, IUpdateSamlGroup, IUpdateSamlRoles, IUpdateSamlVendorMetadata, IUpdateTenantApiTokensData, IUpdateUserApiTokensData, IUserApiTokensData, IUserIdResponse, IVendorConfig, IVerifyMfa, IVerifyMfaResponse, TestConfig, ISSOPublicConfiguration, IPreLoginWithIdpTypeResponse, IPasswordlessPreLogin, IPasswordlessPostLogin, ICreateSSODomain, IVerifyInviteToken, ISSODomain, ISSOConfigurationDefaultRoles, ISSOConfiguration, IUpdateSSOConfiguration, IOidcPostLoginV2, IExchangeOAuthTokens, IOAuthTokenResponse, ISocialLoginProviderConfigurationV2, ILoginResponseV2, IResetPhoneNumber, IVerifyResetPhoneNumber, IChangePhoneNumber, IVerifyResetPhoneNumberResponse, IResetPhoneNumberResponse, IWebAuthnPreLogin, IWebAuthnPostLogin, IVerifyNewWebAuthnDevice, IWebAuthnPreLoginResponse, ICreateNewDeviceSessionResponse, IAuthStrategiesConfig, ISessionResponse, IChangePhoneNumberWithVerification, IChangePhoneNumberWithVerificationResponse, IVerifyChangePhoneNumber, ISessionConfigurations, IResendInvitationEmail, IPreEnrollMFA, IEnrollMFAAuthenticatorApp, IPreEnrollMFASMS, IEnrollMFASMS, IEnrollMFAWebAuthn, IPreEnrollMFAAuthenticatorAppResponse, IPreEnrollMFAWebAuthnResponse, IVerifyMFAAuthenticatorApp, IPreVerifyMFA, IPreVerifyMFASMSResponse, IVerifyMFASMS, IPreVerifyMFAWebAuthnResponse, IVerifyMFAWebAuthn, IPreEnrollMFASMSResponse, IPreDisableMFASMSResponse, IDisableMFASMS, IDisableMFAWebAuthn, IPreDisableMFAWebAuthnResponse, UserMFADevicesResponse, WithoutMFAToken, IMFAStrategiesResponse, IOAuthLogout, IGetUserAccessTokens, IGetTenantAccessTokens, IDeleteAccessToken, ICreateTenantAccessTokenData, ICreateUserAccessTokenData, IWebAuthnDevices, ICustomSocialLoginProviderConfigurationV1, ILoginResponseV3, IPreVerifyMFAEmailCodeResponse, IVerifyMFAEmailCode, ICreateOrUpdateSSOConfigurationByMetadataUrl, GenerateStepUpRequest, GenerateStepUpResponse } from './interfaces';
6
+ import { IAcceptInvitation, IAcceptInvitationWithOTC, IActivateAccount, IActivateAccountWithOTC, IAllowedToRememberMfaDevice, ICreateSamlGroup, IDeleteApiToken, IDisableMfa, IEnrollMfaResponse, IForgotPassword, IGetActivateAccountStrategy, IGetActivateAccountStrategyResponse, IGetUserById, IGetUserPasswordConfig, ILogin, ILoginResponse, ILoginViaSocialLogin, ILoginViaSocialLoginResponse, ILoginWithMfa, IOidcPostLogin, IOidcConfiguration, IPostLogin, IPreLogin, IRecoverMFAToken, IResendActivationEmail, IResetPassword, ISamlConfiguration, ISamlVendorConfigResponse, ISignUpResponse, ISignUpUser, ISocialLoginProviderConfiguration, ITenantApiTokensData, IUpdateSamlConfiguration, IUpdateSamlGroup, IUpdateSamlRoles, IUpdateSamlVendorMetadata, IUpdateTenantApiTokensData, IUpdateUserApiTokensData, IUserApiTokensData, IUserIdResponse, IVendorConfig, IVerifyMfa, IVerifyMfaResponse, TestConfig, ISSOPublicConfiguration, IPreLoginWithIdpTypeResponse, IPasswordlessPreLogin, IPasswordlessPostLogin, ICreateSSODomain, IVerifyInviteToken, ISSODomain, ISSOConfigurationDefaultRoles, ISSOConfiguration, IUpdateSSOConfiguration, IOidcPostLoginV2, IExchangeOAuthTokens, IOAuthTokenResponse, ISocialLoginProviderConfigurationV2, ILoginResponseV2, IResetPhoneNumber, IVerifyResetPhoneNumber, IChangePhoneNumber, IVerifyResetPhoneNumberResponse, IResetPhoneNumberResponse, IWebAuthnPreLogin, IWebAuthnPostLogin, IVerifyNewWebAuthnDevice, IWebAuthnPreLoginResponse, ICreateNewDeviceSessionResponse, IAuthStrategiesConfig, ISessionResponse, IChangePhoneNumberWithVerification, IChangePhoneNumberWithVerificationResponse, IVerifyChangePhoneNumber, ISessionConfigurations, IResendInvitationEmail, IPreEnrollMFA, IEnrollMFAAuthenticatorApp, IPreEnrollMFASMS, IEnrollMFASMS, IEnrollMFAWebAuthn, IPreEnrollMFAAuthenticatorAppResponse, IPreEnrollMFAWebAuthnResponse, IVerifyMFAAuthenticatorApp, IPreVerifyMFA, IPreVerifyMFASMSResponse, IVerifyMFASMS, IPreVerifyMFAWebAuthnResponse, IVerifyMFAWebAuthn, IPreEnrollMFASMSResponse, IPreDisableMFASMSResponse, IDisableMFASMS, IDisableMFAWebAuthn, IPreDisableMFAWebAuthnResponse, UserMFADevicesResponse, WithoutMFAToken, IMFAStrategiesResponse, IOAuthLogout, IGetUserAccessTokens, IGetTenantAccessTokens, IDeleteAccessToken, ICreateTenantAccessTokenData, ICreateUserAccessTokenData, IWebAuthnDevices, ICustomSocialLoginProviderConfigurationV1, ILoginResponseV3, IPreVerifyMFAEmailCodeResponse, IVerifyMFAEmailCode, ICreateOrUpdateSSOConfigurationByMetadataUrl, GenerateStepUpRequest, GenerateStepUpResponse } from './interfaces';
7
7
  import { IGetUserAuthorizationResponse, IUserProfile } from "../users/interfaces";
8
8
  import { BaseApiClient } from '../BaseApiClient';
9
9
  import { SecurityPolicyApi } from './secutiry-poilicy';
@@ -87,6 +87,12 @@ export declare class AuthenticationApi extends BaseApiClient {
87
87
  * @throws exception if activation failed
88
88
  */
89
89
  activateAccountV2: (body: IActivateAccount) => Promise<ILoginResponseV3>;
90
+ /**
91
+ * activating account should be called after registering new user or deactivating account
92
+ * ``activateAccount`` should contains userId, code and the token that has been sent to the user after activation requested.
93
+ * @throws exception if activation failed
94
+ */
95
+ activateAccountWithOTC: (body: IActivateAccountWithOTC) => Promise<ILoginResponseV3>;
90
96
  /**
91
97
  * get account activation configuration.
92
98
  */
@@ -104,11 +110,17 @@ export declare class AuthenticationApi extends BaseApiClient {
104
110
  */
105
111
  resendInvitationEmail: (body: IResendInvitationEmail) => Promise<void>;
106
112
  /**
107
- * activating account should be called after registering new user or deactivating account
108
- * ``activateAccount`` should contains userId and the token that has been sent to the user after activation requested.
109
- * @throws exception if activation failed
113
+ * accepting invitation should be called after inviting user to new account
114
+ * ``acceptInvitation`` should contains userId and the token that has been sent to the user after invitation requested.
115
+ * @throws exception if accept invitation failed
110
116
  */
111
117
  acceptInvitation: (body: IAcceptInvitation) => Promise<void>;
118
+ /**
119
+ * accepting invitation should be called after inviting user to new account
120
+ * ``acceptInvitation`` should contains userId, code and the token that has been sent to the user after invitation requested.
121
+ * @throws exception if accept invitation failed
122
+ */
123
+ acceptInvitationWithOTC: (body: IAcceptInvitationWithOTC) => Promise<void>;
112
124
  /**
113
125
  * refresh token called as authenticated use, access and refresh tokens resolved by the cookies.
114
126
  * the server will return ILoginResponse with new access Token and refresh token and store it in the browser cookies.
package/auth/index.js CHANGED
@@ -190,6 +190,11 @@ export class AuthenticationApi extends BaseApiClient {
190
190
  return this.generateLoginResponseV3(data);
191
191
  };
192
192
 
193
+ this.activateAccountWithOTC = async body => {
194
+ const data = await this.post(`${urls.identity.users.v1}/activate/code`, body);
195
+ return this.generateLoginResponseV3(data);
196
+ };
197
+
193
198
  this.getActivateAccountStrategy = async params => {
194
199
  return this.get(`${urls.identity.users.v1}/activate/strategy`, params);
195
200
  };
@@ -206,6 +211,10 @@ export class AuthenticationApi extends BaseApiClient {
206
211
  return this.post(`${urls.identity.users.v1}/invitation/accept`, body);
207
212
  };
208
213
 
214
+ this.acceptInvitationWithOTC = async body => {
215
+ return this.post(`${urls.identity.users.v1}/invitation/accept/code`, body);
216
+ };
217
+
209
218
  this.refreshToken = async () => {
210
219
  const tabTenantId = getTabTenantFromSessionStorage(this.appName);
211
220
  const data = await this.post(`${urls.identity.auth.v1}/user/token/refresh`, {
@@ -502,6 +511,10 @@ export class AuthenticationApi extends BaseApiClient {
502
511
  queryParams.code_verifier = params.codeVerifier;
503
512
  }
504
513
 
514
+ if (params.codeVerifierPkce) {
515
+ queryParams.code_verifier_pkce = params.codeVerifierPkce;
516
+ }
517
+
505
518
  if (params.state) {
506
519
  queryParams.state = params.state;
507
520
  }
@@ -77,10 +77,16 @@ export declare type IActivateAccount = {
77
77
  recaptchaToken?: string;
78
78
  lastTermsCheck?: string;
79
79
  };
80
+ export declare type IActivateAccountWithOTC = {
81
+ code: string;
82
+ } & IActivateAccount;
80
83
  export declare type IAcceptInvitation = {
81
84
  userId: string;
82
85
  token: string;
83
86
  };
87
+ export declare type IAcceptInvitationWithOTC = IAcceptInvitation & {
88
+ code: string;
89
+ };
84
90
  export declare type IResendActivationEmail = {
85
91
  email: string;
86
92
  };
@@ -192,6 +198,7 @@ export interface ILoginViaSocialLogin {
192
198
  provider: SocialLoginProviders;
193
199
  afterAuthRedirectUrl?: string;
194
200
  codeVerifier?: string;
201
+ codeVerifierPkce?: string;
195
202
  metadata?: string;
196
203
  invitationToken?: string;
197
204
  state?: string;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.2.1
1
+ /** @license Frontegg v3.2.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -273,6 +273,11 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
273
273
  return this.generateLoginResponseV3(data);
274
274
  };
275
275
 
276
+ this.activateAccountWithOTC = async body => {
277
+ const data = await this.post(`${_constants2.urls.identity.users.v1}/activate/code`, body);
278
+ return this.generateLoginResponseV3(data);
279
+ };
280
+
276
281
  this.getActivateAccountStrategy = async params => {
277
282
  return this.get(`${_constants2.urls.identity.users.v1}/activate/strategy`, params);
278
283
  };
@@ -289,6 +294,10 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
289
294
  return this.post(`${_constants2.urls.identity.users.v1}/invitation/accept`, body);
290
295
  };
291
296
 
297
+ this.acceptInvitationWithOTC = async body => {
298
+ return this.post(`${_constants2.urls.identity.users.v1}/invitation/accept/code`, body);
299
+ };
300
+
292
301
  this.refreshToken = async () => {
293
302
  const tabTenantId = (0, _utils.getTabTenantFromSessionStorage)(this.appName);
294
303
  const data = await this.post(`${_constants2.urls.identity.auth.v1}/user/token/refresh`, {
@@ -585,6 +594,10 @@ class AuthenticationApi extends _BaseApiClient.BaseApiClient {
585
594
  queryParams.code_verifier = params.codeVerifier;
586
595
  }
587
596
 
597
+ if (params.codeVerifierPkce) {
598
+ queryParams.code_verifier_pkce = params.codeVerifierPkce;
599
+ }
600
+
588
601
  if (params.state) {
589
602
  queryParams.state = params.state;
590
603
  }
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v3.2.1
1
+ /** @license Frontegg v3.2.2
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontegg/rest-api",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "main": "./node/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {