Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@frontegg/rest-api

Package Overview
Dependencies
Maintainers
1
Versions
608
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontegg/rest-api

<h1 align="cent

  • 1.28.1-alpha-split-store
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Frontegg logo

Stateful React API

Usage

The APIs and states are available by using the using the frontegg rest-api are exposed via promises and interfaces such as the below:

import { someApi } from "@frontegg/rest-api";

await someApi();

Authentication APIs

Pre-login

import { preLogin } from '@frontegg/rest-api';

const redirectUrl = await preLogin({ email: 'john@doe.com' });
if (redirectUrl) {
  // Redirect to SSO
}

Returns if the user needs to be redirected to SSO based on email domain

Login

import { login } from '@frontegg/rest-api';

const loginResponse: {
  accessToken: string;
  refreshToken: string;
  expires: string;
  expiresIn: number;

  mfaRequired: boolean;
  mfaToken?: string; // for multi-factor authentication

  emailVerified?: boolean;
} = await login({ email, password });

Logs in the user using email and password and returns the JWT and refresh token.In case MFA is required the MFA token will be returned

Login with MFA

import { loginWithMfa } from '@frontegg/rest-api';

const loginResponse: {
  accessToken: string;
  refreshToken: string;
  expires: string;
  expiresIn: number;

  mfaRequired: boolean;
  mfaToken?: string; // for multi-factor authentication

  emailVerified?: boolean;
} = await loginWithMfa({ mfaToken, value });

Verifies the login using MFA token and value and gets the JWT token and the refresh token back

Activate account

import { activateAccount } from '@frontegg/rest-api';

await activateAccount({ userId, token, password });

Activates the users' account using the user ID, the token and the users' new password

Accept invitation to tenant

import { acceptInvitation } from '@frontegg/rest-api';

await acceptInvitation({ userId, token });

Accepts invitation of user to a new tenant and makes the user as active on that tenant

Refresh token

import { refreshToken } from '@frontegg/rest-api';

const loginResponse: {
  accessToken: string;
  refreshToken: string;
  expires: string;
  expiresIn: number;

  mfaRequired: boolean;
  mfaToken?: string; // for multi-factor authentication

  emailVerified?: boolean;
} = await refreshToken();

Refresh the current user authentication

Logout

import { logout } from '@frontegg/rest-api';

await logout();

Logs out the user and clears the refresh token

Forgot password

import { logout } from '@frontegg/rest-api';

await logout();

Logs out the user and clears the refresh token

Reset password

import { resetPassword } from '@frontegg/rest-api';

await logout({
  token,
  userId,
  password
});

Resets password based on token received from the forgot password flow

Recover MFA token

Allows the user to recover the MFA token

import { recoverMfaToken } from '@frontegg/rest-api';

await recoverMfaToken({
  email,
  recoveryCode
});

FAQs

Package last updated on 04 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc