Confirm two-factor enrolment with a code.
POST
/api/auth/two-factor/enrol/confirm
const url = 'https://api.tradr.cloud/api/auth/two-factor/enrol/confirm';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tradr.cloud/api/auth/two-factor/enrol/confirm \ --header 'Content-Type: application/json' \ --data '{ "code": "example" }'Validates the submitted authenticator code against the pending secret, then turns two-factor on, shows 10 single-use backup codes once (stored only as one-way hashes) and ends every other session of the user, keeping the current one. Requires an authenticated session; rate limited to 10 management writes per 15 minutes per user; never cached.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
code
required
string
Examplegenerated
{ "code": "example"}Responses
Section titled “ Responses ”The 10 single-use backup codes, shown once.
Media typeapplication/json
object
backupCodes
Array<string>
Examplegenerated
{ "backupCodes": [ "example" ]}Validation error, or the code is wrong (INVALID_TWO_FACTOR_CODE).
No authenticated session.
No pending enrolment to confirm (TWO_FACTOR_NOT_PENDING).
Rate limit exceeded.