Nest Authbeta

POST /auth/mfa/setup-totp

Setup TOTP Device

Setup TOTP Device

POST/auth/mfa/setup-totp

Request body

NestAuthSetupTotpRequestDto

FieldTypeRequiredDescription
labelstringoptionalAccount label shown in the authenticator app (under the issuer). Defaults to the user's email. Use it to disambiguate multiple accounts of the same person — e.g. `"ada@acme.com (Acme Corp)"` in a multi-tenant app.
Example: ada@acme.com (Acme Corp)
deviceNamestringoptionalHuman-readable name stored for this authenticator device (not shown in the app). Defaults to `{appName} : {email}`.
Example: iPhone Authenticator

Examples

Example
{
  "label": "ada@acme.com (Acme Corp)",
  "deviceName": "iPhone Authenticator"
}

Responses

200
400Invalid or expired code.

ApiErrorResponseDto

FieldTypeRequiredDescription
statusCodenumberrequiredHTTP status code
Example: 401
errorstringrequiredHTTP status text / exception name
Example: Unauthorized
messagestringrequiredHuman-readable message
Example: Invalid credentials
codestringrequiredStable, machine-readable error code — branch on this, not the message
Example: INVALID_CREDENTIALS

Example response

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "code": "INVALID_CREDENTIALS"
}
401Missing, invalid, or expired authentication.

ApiErrorResponseDto

FieldTypeRequiredDescription
statusCodenumberrequiredHTTP status code
Example: 401
errorstringrequiredHTTP status text / exception name
Example: Unauthorized
messagestringrequiredHuman-readable message
Example: Invalid credentials
codestringrequiredStable, machine-readable error code — branch on this, not the message
Example: INVALID_CREDENTIALS

Example response

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "code": "INVALID_CREDENTIALS"
}
403Authenticated but not permitted.

ApiErrorResponseDto

FieldTypeRequiredDescription
statusCodenumberrequiredHTTP status code
Example: 401
errorstringrequiredHTTP status text / exception name
Example: Unauthorized
messagestringrequiredHuman-readable message
Example: Invalid credentials
codestringrequiredStable, machine-readable error code — branch on this, not the message
Example: INVALID_CREDENTIALS

Example response

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "code": "INVALID_CREDENTIALS"
}

Try it

curl -X POST 'https://api.example.com/auth/mfa/setup-totp' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -d '{"label":"ada@acme.com (Acme Corp)","deviceName":"iPhone Authenticator"}'

On this page