Endpoint
Request Body
The ID of the user attempting to authenticate. Cannot be empty.
The TOTP code provided by the user from their authenticator app.
Request Example
Response
Success Response
Returns
"OK" when the TOTP code is validError Responses
Unknown User ID
Returns
"UNKNOWN_USER_ID_ERROR" when the user has no verified TOTP devicesInvalid TOTP Code
Returns
"INVALID_TOTP_ERROR" when the provided code is incorrectThe number of failed attempts so far (available in v5.0+)
The maximum number of failed attempts allowed (available in v5.0+)
Rate Limit Reached
Returns
"LIMIT_REACHED_ERROR" when too many failed attempts have occurredThe number of milliseconds to wait before retrying
The number of failed attempts (available in v5.0+)
The maximum allowed failed attempts (available in v5.0+)
Implementation Details
Source: View source- This endpoint checks the TOTP code against all verified devices for the user
- If the code matches any verified device, authentication succeeds
- Failed attempts are tracked per user to prevent brute force attacks
- Rate limiting is enforced after reaching the maximum number of failed attempts
- The code is checked using the device’s configured
skewandperiodparameters
Typical MFA Flow
- User completes primary authentication (e.g., email/password)
- Application prompts for TOTP code
- User opens authenticator app and enters the current code
- Application calls this endpoint to verify the code
- If successful (
status: "OK"), user is fully authenticated - If failed, show error and allow retry (respecting rate limits)
Security Considerations
- Always implement rate limiting on the client side based on the response
- Display
retryAfterMsto users when rate limited - Track failed attempts and warn users before reaching the limit
- Consider implementing account lockout after multiple failed MFA attempts
Error Handling
Returned when
userId is emptyRelated Endpoints
Create TOTP Device
Register a new authenticator device
Verify Device
Verify a newly created device