Intercode SaaS Kit
  • Welcome to SaaS Starter Kit
  • Getting Started
    • Technology stack
    • Database Setup
    • Local Environment Setup
  • Basics
    • Dependencies
    • App architecture
    • Deployment
    • App roles
    • Endpoints List
      • Auth
      • Two Factor Auth
      • Businesses
      • Demo
      • Email
      • Export Document
      • Email Files
      • Files Demo
      • Leads
      • Orders
      • Payments
      • Subscriptions
      • Teams
      • Team Memberships
      • User Admin
  • Animation and Styles
    • Framer Motion
    • Ant Design and Styles
  • Pages
    • Auth
      • Working with PassportJS
      • Two-Factor Auth
      • OAuth Providers
    • Leads
    • Businesses
    • Team management
      • Ownership
    • Profile
    • User Settings
      • App Tour
    • App Settings
      • Lead Statuses
    • Dashboard
      • Lead volume widget
      • Doughnut chart widget
      • Recent leads table widget
      • Lead count over period widget
    • Demo
  • Features
    • Impersonation
    • Subscriptions (Stripe)
    • Search
    • Sentry
    • Captcha
    • Audit Logs
    • Internationalization
  • External integrations
    • Mailer
    • Google oAuth2
    • Facebook oAuth2
    • S3 compatible storage (AWS, MinIO)
Powered by GitBook
On this page
  1. Basics
  2. Endpoints List

Two Factor Auth

PreviousAuthNextBusinesses

Last updated 6 months ago

GET

POST

Generates a QR code for enabling two-factor authentication.

get
Responses
200
QR code generated successfully
application/json
400
QR code was already generated
application/json
get
GET /2fa/generate-qr HTTP/1.1
Host: 
Accept: */*
{
  "qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "link": "otpauth://totp/AppName:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=AppName"
}

Disables two-factor authentication for the user.

post
Responses
200
Two-factor authentication disabled successfully
application/json
ResponseanyExample: {"message":"Two-factor authentication disabled successfully","description":"Two-factor authentication has been disabled for your account."}
500
Internal server error
application/json
post
POST /2fa/disable-two-factor-auth HTTP/1.1
Host: 
Accept: */*
{
  "message": "Two-factor authentication disabled successfully",
  "description": "Two-factor authentication has been disabled for your account."
}

Cancels the impersonation and returns the original user's tokens.

post
Responses
200
Impersonation cancelled successfully
application/json
403
Invalid token
application/json
404
User not found
application/json
500
Internal server error
application/json
post
POST /2fa/desimpersonation HTTP/1.1
Host: 
Accept: */*
{
  "accessToken": "access_token",
  "refreshToken": "refresh_token"
}
  • GET
  • GETGenerates a QR code for enabling two-factor authentication.
  • POST
  • POSTEnables two-factor authentication for the user.
  • POSTDisables two-factor authentication for the user.
  • POSTAuthenticates the user using two-factor authentication code.
  • POSTImpersonates another user using two-factor authentication code. This endpoint is only available for admins of support team.
  • POSTCancels the impersonation and returns the original user's tokens.

Enables two-factor authentication for the user.

post
Body
codestringRequired

Two-factor authentication code

Example: 123456
Responses
200
Two-factor authentication enabled successfully
application/json
ResponseanyExample: {"message":"Two-factor authentication enabled successfully","description":"Two-factor authentication has been enabled for your account."}
400
Invalid two-factor authentication code
application/json
500
Internal server error
application/json
post
POST /2fa/enable-two-factor-auth HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "code": "123456"
}
{
  "message": "Two-factor authentication enabled successfully",
  "description": "Two-factor authentication has been enabled for your account."
}

Authenticates the user using two-factor authentication code.

post
Body
codestringRequired

Two-factor authentication code

Example: 123456
Responses
200
Authentication successful
application/json
400
Invalid two-factor authentication code
application/json
500
Internal server error
application/json
post
POST /2fa/authenticate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "code": "123456"
}
{
  "accessToken": "access_token",
  "refreshToken": "refresh_token",
  "isTwoFactorEnable": true
}

Impersonates another user using two-factor authentication code. This endpoint is only available for admins of support team.

post
Body
userIdnumberRequiredExample: 1
teamIdnumberRequiredExample: 1
codestringRequiredExample: 123456
Responses
200
Impersonation successful
application/json
400
Invalid two-factor authentication code
application/json
403
Access denied if user is not an admin.
application/json
404
User not found
application/json
500
Internal server error
application/json
post
POST /2fa/impersonate HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 39

{
  "userId": 1,
  "teamId": 1,
  "code": "123456"
}
{
  "accessToken": "access_token",
  "isTwoFactorEnable": false
}