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:
- On
/account,startTwoFactorSetupFn()answerssecretandotpauthUrl: show the address as a QR code and the secret as text. 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.disableTwoFactorFn({ password, code })turns it off. A recovery code works once wherever a code is asked for.- On
/sign-in, whensignInFnanswersstatus: "two-step-needed", ask for the code and callverifyTwoFactorFn({ code }).
Limits
The two-step challenge lasts 10 minutes.
Locally
Works the same in stackly dev, with a real authenticator app.