post_mfa_setup

POST /mfa/setup

Setup MFA Method

Initialize the setup process for a multi-factor authentication method. This endpoint prepares the MFA setup and returns the necessary configuration data.

TypeScript Client Library

// Note: This endpoint doesn't have a direct client method in the provided TypeScript client
// You would need to use the generic makeRequest method:
// this.makeRequest<any>('mfa/setup', 'POST', { 
//   mfaType: 'GOOGLE_AUTH', 
//   email: '[email protected]',
//   deviceInfo: { name: 'iPhone 12', type: 'mobile' }
// });

Code Samples

# You can also use wget
curl -X POST https://backend.flashback.tech/mfa/setup \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}' \
  -d '{
    "mfaType": "GOOGLE_AUTH",
    "email": "[email protected]",
    "deviceInfo": {
      "name": "iPhone 12",
      "type": "mobile"
    }
  }'

Request Body

Name
Type
Required
Description

mfaType

string

true

Type of MFA method to setup

email

string

false

Email address (required for magic links)

deviceInfo

object

false

Device information for passkeys

Body parameter

{
  "mfaType": "GOOGLE_AUTH",
  "email": "[email protected]",
  "deviceInfo": {
    "name": "iPhone 12",
    "type": "mobile"
  }
}

Example responses

200 Response

{
  "success": true,
  "data": {
    "secret": "JBSWY3DPEHPK3PXP",
    "qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "backupCodes": ["123456", "789012", "345678"]
  }
}

400 Response

{
  "success": false,
  "error": "Invalid MFA type specified"
}

500 Response

{
  "success": false,
  "error": "Failed to setup MFA"
}

Responses

Status
Meaning
Description
Schema

200

MFA setup initiated successfully

Inline

400

Invalid request parameters

Inline

500

Internal server error

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» data

object

false

none

MFA setup configuration data

Status Code 400

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» error

string

false

none

Error message describing the validation issue

Status Code 500

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» error

string

false

none

Error message describing the issue

Enumerated Values

Parameter
Value
Description

» mfaType

GOOGLE_AUTH

Google Authenticator TOTP

» mfaType

MAGIC_LINK

Magic link email verification

» mfaType

PASSKEY

WebAuthn passkey authentication

Last updated

Was this helpful?