Create a one-time authentication secret and code

This function generates a random secret and a one-time password authentication (OTP auth) URL for the user. Use the secret that this function returns and a valid verification token with WHM API 1's twofactorauth_set_tfa_config function to configure Two-Factor Authentication (2FA) on an account.

Authorizations:

Responses

Response Schema: application/json
object
object

Request samples

whmapi1 --output=jsonpretty \
  twofactorauth_generate_tfa_config

Response samples

Content type
application/json
{
  • "data": {
    • "otpauth_str": "otpauth://totp/Example:root?secret=CAOXW75HKYJJ6E5Y&issuer=Example",
    • "secret": "WJ73QJSKZBXCFIPZ"
    },
  • "metadata": {
    • "command": "twofactorauth_generate_tfa_config",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}