Skip to content
sadhasivam edited this page Sep 10, 2024 · 1 revision

Enable Two-Factor Authentication

URL: /api/admin/2fa/enable

Method: POST

Description: Enables Two-Factor Authentication (2FA) for the authenticated user and provides a QR code for setting up 2FA in an authenticator app.

Parameters

This endpoint does not require any parameters.

Response

{
    "success": true,
    "message": "",
    "data": {
        "image": "sample.img",
        "secret": "example_secret_key"
    }
}

Generate Recovery Code

URL: /api/admin/2fa-recovery-code

Method: POST

Description: Generates a new recovery code for the user and returns it in the response.

Parameters

This endpoint does not require any parameters.

Request Example

{
    "success": true,
    "message": "",
    "data": {
        "code": "new_recovery_code"
    }
}

2FA Token Validation

URL: /api/admin/2fa/setupValidate

Method: POST

Description: Validates the provided 2FA token and enables 2FA for the user if the token is correct.

Parameters

Parameter Type Required/Optional Description
totp string Required The one-time password (2FA token) provided by the user.

Response

{
    "success": true,
    "message": "Passcode is valid"
    "data": "",
}

Disable Two Factor Authentication

URL: /api/admin/2fa/disable

Method: POST

Description: Disables two-factor authentication (2FA) for the authenticated user and clears any associated backup codes.

Parameters

This endpoint does not require any parameters.

Response

{
    "success": true,
    "message": "2 Factor Authentication has been disabled"
    "data": "",
}

Download Recovery Codes

URL: /api/admin/2fa/downloadRecoveryCode

Method: GET

Description: Downloads a file containing backup recovery codes for the authenticated user.

Parameters

This endpoint does not require any parameters.

Response

SAVE YOUR BACKUP CODES
Keep these backup codes somewhere safe but accessible.

'kbdhbhdbki7y3e623'   'buyvb782eh2ndkkh'

(admin), * You can only use each backup code once.
* Need more? [base_url]

Verify Password

URL: /api/admin/verify/password

Method: POST

Description: Verifies the provided password for the authenticated user.

Parameters

Parameter Type Required/Optional Description
password string Required The password to be verified.

Response

{
    "success": true,
    "message": "Password is Verified"
    "data": "",
}

Clone this wiki locally