Two-Factor Authentication
Enrolment is two steps on purpose: setup stores the secret unconfirmed, and enable only trusts it once a generated code proves the authenticator holds it — so an abandoned setup cannot lock anyone out.Setup
otpauth:// URI for scanning with an authenticator app. Requires an active session_token.
Idempotent Behavior
Calling setup twice returns the same secret rather than generating a new one. This prevents a QR already scanned into a phone from silently stopping to match. Pass?regenerate=true as a query parameter to force a fresh secret.
Responses
Errors
Enable
/api/v1/auth/2fa/setup by requiring a valid code from the authenticator. Once confirmed, two-factor is enforced on all future logins.
Request
Parameters
Responses
Behavior
- Activates two-factor authentication on the account.
- Signs out every other active session (bumps
tokenVersion), then reissues the caller’s cookie. - Returns 10 single-use recovery codes — shown exactly once. The server stores only their hashes.
- The clock-drift message is returned when the code matches a step several windows away, indicating a time sync problem rather than a wrong secret.
Errors
Disable
Request
Parameters
Responses
Behavior
- Disables two-factor authentication.
- Clears the TOTP secret and all stored recovery code hashes.
- Signs out every other active session (bumps
tokenVersion), then reissues the caller’s cookie.
