Skip to content

Confirm the authenticator

POST
/v1/auth/2fa/totp/confirm
curl --request POST \
--url https://api.emite.cr/v1/auth/2fa/totp/confirm \
--header 'Content-Type: application/json' \
--data '{ "password": "example", "code": "123456" }'

Confirms the authenticator started at POST /v1/auth/2fa/totp/setup with the current password and a live code from it: from then on, signing in asks for it. When it is the first method of the account, the response carries the recovery codes, shown this one time. Closes every OTHER session of the person — they were opened without the second factor. This session continues under a new token, returned in the X-Session-Token header. 409 TWO_FACTOR_SETUP_REQUIRED when no setup was started, 409 TWO_FACTOR_ALREADY_ENABLED when it is already active, 400 INVALID_TWO_FACTOR_CODE for a wrong code.

Media typeapplication/json
object
password
required

The current password of the account. A wrong one answers 400 INVALID_CURRENT_PASSWORD.

string
code
required

Current 6-digit code from the authenticator app.

string
Example
123456

The authenticator is active; recoveryCodes when it is the first method.

Media typeapplication/json
object
recoveryCodes

Present only when this method is the first second factor of the account: the 10 single-use recovery codes (xxxx-xxxx-xxxx), returned this one time — the API keeps only a hash of each. Absent (an empty object) when another method was already active: the existing codes stay as they were.

Array<string>
Example
{
"recoveryCodes": [
"k7m2-p9qx-4hzt",
"a3vb-8wnr-c6je"
]
}