Two-factor authentication (TOTP)
Enable TOTP 2FA with better-auth’s 2FA plugin in generated Simulacrum apps.
Enable 2FA
Turn on the better-auth two-factor plugin in your auth configuration. Users enroll by scanning a QR code in an authenticator app.
User flow
- User signs in with primary method (password or OAuth).
- If 2FA is enabled, prompt for a TOTP code.
- On success, issue a full session.
Recovery
Ship one-time backup codes or account recovery via support flows. Document your policy in product copy.
Store TOTP secrets encrypted at rest. Never log OTP attempts with the secret material.