twofa.php¶
Two-factor authentication module for managing and verifying security codes via TOTP, email, or SMS.
API Methods¶
| Method | Action | Description |
|---|---|---|
send_email_code | Send a verification code to the user's email address | Triggers the delivery of a 2FA verification code via email. |
send_sms_code | Send a verification code via SMS | Triggers the delivery of a 2FA verification code via SMS. |
set_method_email | Set email as the 2FA method | Configures the user's two-factor authentication method to use email. |
set_method_none | Disable 2FA method | Disables two-factor authentication for the user. |
set_method_sms | Set SMS as the 2FA method | Configures the user's two-factor authentication method to use SMS. |
set_method_totp | Set TOTP as the 2FA method | Configures the user's two-factor authentication method to use TOTP (Authenticator apps). |
verify_code | Verify 2FA code | Verifies the provided security code against the active 2FA method. |
verify_email_code | verify email code | Verifies the authentication code sent via email. |
verify_sms_code | verify sms code | Verifies the authentication code sent via SMS. |
verify_totp_code | verify totp code | Verifies the TOTP (Time-based One-Time Password) code from an authenticator app. |
twofa/send_email_code¶
Triggers the delivery of a 2FA verification code via email.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: send_email_code |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/send_sms_code¶
Triggers the delivery of a 2FA verification code via SMS.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: send_sms_code |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/set_method_email¶
Configures the user's two-factor authentication method to use email.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_method_email |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/set_method_none¶
Disables two-factor authentication for the user.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_method_none |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/set_method_sms¶
Configures the user's two-factor authentication method to use SMS.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_method_sms |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/set_method_totp¶
Configures the user's two-factor authentication method to use TOTP (Authenticator apps).
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: set_method_totp |
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/verify_code¶
Verifies the provided security code against the active 2FA method.
HTTP method: POST
Parameters:
| action | ✅ | string | Method identifier: verify_code |
|---|---|---|---|
| token | ✅ | string | Authentication token for the session. |
Request example
twofa/verify_email_code¶
Verifies the authentication code sent via email.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: verify_email_code |
| token | ✅ | string | Authentication token for the request. |
| code | ✅ | string | The verification code received via email. |
Request example
Success response example
twofa/verify_sms_code¶
Verifies the authentication code sent via SMS.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: verify_sms_code |
| token | ✅ | string | Authentication token for the request. |
| code | ✅ | string | The verification code received via SMS. |
Request example
Success response example
twofa/verify_totp_code¶
Verifies the TOTP (Time-based One-Time Password) code from an authenticator app.
HTTP method: POST
Parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
| action | ✅ | string | Method identifier: verify_totp_code |
| token | ✅ | string | Authentication token for the request. |
| code | ✅ | string | The TOTP code from the authenticator application. |
Request example