Disable two-factor authentication
const url = 'https://api.emite.cr/v1/auth/2fa/disable';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"password":"example","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.emite.cr/v1/auth/2fa/disable \ --header 'Content-Type: application/json' \ --data '{ "password": "example", "code": "example" }'Turns two-factor authentication off entirely: both methods and the recovery codes are deleted. Requires the current password and a second-factor proof in code: a code from the authenticator, an unused recovery code or, when email is the sole method, the code from POST /v1/auth/2fa/email/management-code (400 TWO_FACTOR_CODE_REQUIRED without one, 400 INVALID_TWO_FACTOR_CODE for a wrong one). 409 TWO_FACTOR_NOT_ENABLED when it is already off. The person receives an email notice.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The current password of the account. A wrong one answers 400 INVALID_CURRENT_PASSWORD.
Proof of the second factor, required although the schema marks it optional (400 TWO_FACTOR_CODE_REQUIRED without it): a current code from the authenticator app, an unused recovery code (spent by this call), or, only when email is the sole method of the account, the code sent by POST /v1/auth/2fa/email/management-code. A wrong one answers 400 INVALID_TWO_FACTOR_CODE.
Examplegenerated
{ "password": "example", "code": "example"}