Child pages
  • WHM API 1 Functions - twofactorauth_set_tfa_config

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Description

Excerpt

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.

Panel
bgColor#F2F2F2
borderStylenone

Examples 


Panel
bgColor#FFFFFF
borderStylenone
Expand
titleJSON API
Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/twofactorauth_set_tfa_config?api.version=1&secret=WJ73QJSKZBXCFIPZ&tfa_token=227174
Expand
titleXML API
Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/xml-api/twofactorauth_set_tfa_config?api.version=1&secret=WJ73QJSKZBXCFIPZ&tfa_token=227174
Expand
titleCommand Line
Code Block
languagebash
whmapi1 twofactorauth_set_tfa_config secret=WJ73QJSKZBXCFIPZ tfa_token=227174

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote

Expand
titleOutput (JSON)
Code Block
languagetext
linenumberstrue
{
   "metadata" : {
      "version":1,
      "reason":"OK",
      "command":"twofactorauth_set_tfa_config",
      "result":"1"
   },
   "data":{
      "success":1
   }
}
Expand
titleOutput (XML)
Code Block
languagetext
linenumberstrue
<result>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>twofactorauth_set_tfa_config</command>
    </metadata>
    <data>
        <success>1</success>
    </data>
</result>

Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote

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