403.
Turn it on for your account
1
Start enrolment
Open Settings → Security and start setting up two-factor
authentication. TRUSTIVAN issues a secret and shows it as a QR code and as
text.Over the API this is
POST /api/v1/auth/mfa/enroll. The response carries
secret and provisioning_uri (an otpauth:// URI), and it is the only
time the secret is returned. A 409 means you are already enrolled.2
Add it to your authenticator
Scan the code, or paste the secret, into an authenticator app that
supports TOTP.
3
Confirm with a code
Enter the six-digit code the app shows. This is
POST /api/v1/auth/mfa/confirm with {"code": "123456"}.Until you confirm, the factor challenges nobody: an enrolment you started
and abandoned does not protect your sign-in, and Settings says so.4
Store your recovery codes
Confirming returns ten recovery codes. They are stored hashed and cannot
be shown again, so put them in your password manager now.
Signing in afterwards
A correct password no longer returns a session.POST /api/v1/auth/login
answers 200 with mfa_required: true and a challenge_token, and sets no
cookies. Branch on mfa_required, not on the status code. The session is
issued only when that token is exchanged with a code:
code is a current TOTP code or a recovery code. Both are single-use: a TOTP
code that has already been spent on your account is refused even inside its
30-second window.
A challenge lasts five minutes and allows five attempts. Every failure (wrong
code, replayed code, expired or unknown challenge, attempts used up) is the
same 401. If you run out, sign in with your password again to get a new
challenge.
Recovery codes
Each recovery code works once, in place of a TOTP code, anywhere a code is asked for at sign-in. They are the only self-service way back into an account whose authenticator is lost. Settings warns you when you are nearly out.GET /api/v1/auth/mfa reports the
same thing:
POST /api/v1/auth/mfa/recovery-codes with a current TOTP code or an unused
recovery code. Every previous code stops working the moment the new set is
returned.
Passkeys
Open Settings → Security → Passkeys and choose Add a passkey. Your browser asks you to confirm with the device (Touch ID, Windows Hello, a phone or a security key) or to save it in your password manager. An account can hold up to 20. A passkey does two things:- Passwordless sign-in. Sign in with a passkey on the sign-in page signs you in with no password. The device verifies you (PIN or biometric), so this is two factors in one gesture. The same SSO enforcement applies as to a password.
- Second factor. Once you hold a passkey, a password alone no longer signs
you in:
POST /api/v1/auth/loginanswersmfa_requiredwithmethods: ["passkey", "recovery_code"](plustotpif you also have an authenticator app), and Use a passkey finishes the sign-in.
POST /api/v1/auth/passkeys/options, then POST /api/v1/auth/passkeys with the browser’s answer; /auth/passkey/login/options
and /auth/passkey/login for passwordless sign-in. The browser ceremony needs
the dashboard’s origin; a deployment whose dashboard is not at DASHBOARD_URL
sets WEBAUTHN_RP_ID and WEBAUTHN_ORIGINS
(environment). A passkey is bound to its relying
party ID for life: changing it means every passkey is registered again.
Turn it off
Settings → Security, orDELETE /api/v1/auth/mfa with {"code": "…"}.
A current code or a recovery code is required as well as your session.
Removing the factor is exactly what somebody holding a stolen session would
want to do, so the session alone does not authorize it.
If your organization requires a second factor, you are sent through enrolment
again at your next sign-in.
Require it for everyone
An owner can require a second factor for every member, under Settings → Security → Require two-factor authentication or:identity:manage, which only the owner role holds and no API key
can be granted. Once it is on:
- A member with no confirmed factor is held at enrolment on their next
password or social sign-in, before any session exists. The sign-in
answers with
mfa_enrollment_required: trueand a challenge token, and the dashboard walks them through the same four steps as above. - A member with no confirmed factor cannot renew a session they already have.
- Single sign-on sessions are exempt. Your identity provider owns that factor, so enforce it there.
mfa_policy.changed.
Where a code is asked for again
A second factor is not only checked at sign-in. With one enrolled, you are asked for a current TOTP code when you:- change your password (a recovery code is not accepted here);
- approve an irreversible action by an AI agent.
See also
- Manage your account: password, email verification and signing out everywhere.
- Credential handling: how session credentials are issued and bounded.