Two-factor sign-in
A portal’s Two-factor setting (a row of its Sign-in tab) is Off, Optional or Required. The second factor is an authenticator app’s code (TOTP: 30 seconds, 6 digits) or one of 10 recovery codes.

- Optional: users turn it on at
/_portal/account(link to it from your app): a QR code and the key as text, a code to check, then the recovery codes, shown once. - Required: an account without it sets it up at its next sign-in, before its session.
- Every sign-in of an account with two-factor asks the code after the first step, whichever it was: password, magic link, Google, Microsoft, an invite, a confirmation, a password reset. Each code works once; 5 tries per sign-in, 20 an hour per account.
- Users make new recovery codes and turn it off on the account page (off: not on a
portal that requires it). For someone who lost their device, your service runs
space-env web-portal reset-2fa SUB; they set it up again at their next sign-in if the portal requires it.
The authenticator’s secret is stored encrypted, recovery codes only as hashes. Your
service sees nothing of it: the identity it gets is the same with or without two-factor
(space-env web-portal users says who has it on).
Last updated on