Skip to content

Latest commit

 

History

History
126 lines (103 loc) · 3.63 KB

File metadata and controls

126 lines (103 loc) · 3.63 KB

Reset Users TOTP

Reset the Two-factor authentication via TOTP for a user in the workspace.

{% hint style="info" %}

URL Requires Auth HTTP Method
/api/v1/users.resetTOTP yes POST

Headers

ArgumentExampleRequiredDescription
X-User-Idmyuser-nameRequiredThe authenticated user ID.
X-Auth-Tokenmyauth-tokenRequiredAuth token.
x-2fa-code148750RequiredThe 2fa code.

Payload

ArgumentExampleRequiredDescription
userIdQ29yYlEZEByCLOQa70-QGNLRjVRhshsN2Sky6-FLAlMXbhURequiredThe userId of the user whose e2e key you want to reset. You can also use username.

Example Payload

{
    "userId":"GonjPyg3gB3Z9ur9s"
}

Example Call

curl --location 'http://localhost:3000/api/v1/users.resetTOTP' \
--header 'x-auth-token: Q29yYlEZEByCLOQa70-QGNLRjVRN2Sky6-FLAlMXbhU' \
--header 'x-user-id: GonjPyg3gB3Z9ur9s' \
--header 'x-2fa-code: 175842' \
--data '{
    "userId":"GonjPyg3gB3Z9ur9s"
}'

Example Result

{
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

  • Authorization: Requires an authentication token for the request to be made.
  • No Permission: This occurs when the authenticated user doesn't have the edit-other-user-totp permission.
  • Invalid User: This occurs when the userId or username in the body is invalid.
  • TOTP Required: Requires two-factor authentication for the request to be made.
  • Invalid TOTP: Requires a valid two-factor authentication code.

{% tabs %} {% tab title="Authorization" %}

{
    "status": "error",
    "message": "You must be logged in to do this."
}

{% endtab %}

{% tab title="No Permission" %}

{
    "success": false,
    "error": "Not allowed [error-not-allowed]",
    "errorType": "error-not-allowed"
}

{% endtab %}

{% tab title="Invalid User" %}

{
    "success": false,
    "error": "The required \"userId\" or \"username\" param provided does not match any users [error-invalid-user]",
    "errorType": "error-invalid-user"
}

{% endtab %}

{% tab title="TOTP Required" %}

{
    "success": false,
    "error": "TOTP Required [totp-required]",
    "errorType": "totp-required",
    "details": {
        "method": "totp",
        "codeGenerated": false,
        "availableMethods": [
            "totp"
        ]
    }
}

{% endtab %}

{% tab title="Invalid TOTP" %}

{
    "success": false,
    "error": "TOTP Invalid [totp-invalid]",
    "errorType": "totp-invalid",
    "details": {
        "method": "totp",
        "codeGenerated": false
    }
}

{% endtab %} {% endtabs %}

Change Log

Version Description
3.6.0 Added