Native Guard
Invalid TOTP Code 401
The TOTP code sent to step up the session does not match the user's authenticator.
https://errors.swepay.com.br/native-guard/step-up-totp-invalid-code What this means
Returned by POST /identity/v1/realms/{realm}/stepup/totp when the access
token, its session and the user's enrollment are all valid, but the code
does not verify. A code is accepted for its own 30-second step and the one
immediately before or after it. Backup (recovery) codes are not accepted on
this endpoint.
The session is left unchanged — the access token that was sent stays valid
at its current level. Each rejected code counts against the same
failed-attempt budget as sign-in: when the realm's limit is reached the
account is locked, and further attempts — even with a correct code — return
Too Many Requests with a Retry-After header
until the lockout ends. A successful step-up resets the count.
Common causes
- The code was mistyped, or it expired before the request arrived.
- The clock of the device running the authenticator app is out of sync.
- The code came from a different account or an older enrollment in the authenticator app.
- A backup code was sent instead of a code from the authenticator app.
How to resolve
Retryable with a new code, within the attempt budget. Ask the user for the
six-digit code currently shown by the authenticator app and send it again
with the same access token. Do not retry automatically and do not resend the
rejected code: every wrong code brings the account closer to a lockout that
also blocks sign-in. If the response becomes 429, wait for Retry-After
before any new attempt.
Example response
{
"type": "https://errors.swepay.com.br/native-guard/step-up-totp-invalid-code",
"title": "Invalid TOTP Code",
"status": 401,
"detail": "The TOTP code is invalid.",
"traceId": "Root=1-00000000-000000000000000000000000;Parent=0000000000000000;Sampled=0"
} References
Machine-readable: /native-guard/step-up-totp-invalid-code.json