All docs pages
Docs

Two-step sign-in

A code from an authenticator app on top of the password.

In stackly.json and the CLI it is two-factor. It has no price of its own; see What features cost.

two-factor · optional · needs sign-in · TOTP in the sign-in kit

A code from an authenticator app (Google Authenticator, 1Password, Authy) on top of the password.

Turn it on

"features": ["backend", "database", "email", "sign-in", "two-factor"]

Use it

All in src/lib/auth.ts:

  1. On /account, startTwoFactorSetupFn() answers secret and otpauthUrl: show the address as a QR code and the secret as text.
  2. enableTwoFactorFn({ code }) turns it on once the person types a code from their app, and answers 8 one-time recovery codes. Show them once and ask the person to keep them.
  3. disableTwoFactorFn({ password, code }) turns it off. A recovery code works once wherever a code is asked for.
  4. On /sign-in, when signInFn answers status: "two-step-needed", ask for the code and call verifyTwoFactorFn({ code }).

Limits

The two-step challenge lasts 10 minutes.

Locally

Works the same in stackly dev, with a real authenticator app.

All app features