Description

This function sets the secret and the authentication code for Two-Factor Authentication (2FA) for the root or reseller account.

You can generate a random secret and an OTP authentication URL with WHM API 1's twofactorauth_generate_tfa_config function.

Examples 


https://hostname.example.com:2087/cpsess##########/json-api/twofactorauth_set_tfa_config?api.version=1&secret=WJ73QJSKZBXCFIPZ&tfa_token=227174
https://hostname.example.com:2087/cpsess##########/xml-api/twofactorauth_set_tfa_config?api.version=1&secret=WJ73QJSKZBXCFIPZ&tfa_token=227174
whmapi1 twofactorauth_set_tfa_config secret=WJ73QJSKZBXCFIPZ tfa_token=227174

{
   "metadata" : {
      "version":1,
      "reason":"OK",
      "command":"twofactorauth_set_tfa_config",
      "result":"1"
   },
   "data":{
      "success":1
   }
}
<result>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>twofactorauth_set_tfa_config</command>
    </metadata>
    <data>
        <success>1</success>
    </data>
</result>

Parameters

ParameterTypeDescriptionPossible valuesExample
secretstring

Required

A generated code for use with 2FA.

A valid 16-character Base32 string.
WJ73QJSKZBXCFIPZ
tfa_tokenstring

Required

The time-based one-time password (TOTP) that the authentication app provides.

A valid security code.
227174

Returns

ReturnTypeDescriptionPossible valuesExample
successBoolean

Whether the account successfully enabled 2FA.

  • 1 — Enabled.
  • 0 — Not enabled.
1