Tearleads

POST/auth/two-factor/enable

Turn on two-factor authentication

Operation auth.twoFactor.enable

Description

Confirms the pending authenticator with its current code and turns on two-factor authentication. The response carries ten single-use recovery codes, shown only once. The calling session counts as having passed a second factor; the identity's other sessions are revoked, so each device signs in again with a code. A wrong code returns 400 and repeated wrong codes lock code entry for a while with 429.

Authentication

Requires a signed-in session: the client sends its session token as a bearer token in the Authorization header.

Request body

application/jsonTwoFactorEnableRequest

Confirms a pending authenticator with its current code, turning two-factor on.

2 fields
  • codestringrequired
    • 1 to 32 characters

    The authenticator's current six-digit code.

  • rememberDevicebooleanrequired

    True to also receive a device token for this device's later sign-ins.

Other fields are allowed.

Responses

200 OK

application/jsonTwoFactorEnableResponse

Two-factor is on: the recovery codes, shown once, and the device token if one was asked for.

3 fields
  • deviceTokenstringoptional
    • not empty
  • enabledbooleanrequired
    • always true
  • recoveryCodeslist of stringrequired
    • each item: not empty

Other fields are allowed.

Other responses

StatusMeaningBody
400Bad Request

application/jsonTwoFactorErrorResponse

401Unauthorized

application/jsonSessionFailureResponse

409Conflict

application/jsonTwoFactorErrorResponse

429Too Many Requests

application/jsonTwoFactorErrorResponse

500Internal Server Error

application/jsonErrorResponse

503Service Unavailable

application/jsonErrorResponse