Nest Authbeta

POST /auth/mfa/verify-totp-setup

Verify TOTP Setup

Verify TOTP Setup

POST/auth/mfa/verify-totp-setup

Request body

NestAuthVerifyTotpSetupRequestDto

FieldTypeRequiredDescription
otpstringrequiredThe TOTP code from authenticator app
Example: 123456
secretstringrequiredSecret key from TOTP setup
Example: JBSWY3DPEHPK3PXP

Examples

Example
{
  "otp": "123456",
  "secret": "JBSWY3DPEHPK3PXP"
}

Responses

200

NestAuthMfaDeviceVerifiedResponseDto

FieldTypeRequiredDescription
messagestringrequiredResponse message
Example: Device setup successfully

Example response

{
  "message": "Device setup successfully"
}
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/verify-totp-setup' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -d '{"otp":"123456","secret":"JBSWY3DPEHPK3PXP"}'

On this page