Two Factor Setup
Turn on an authenticator app: scan the QR code or copy the key, confirm a code, then save the backup codes (copy or download).
import { TwoFactorSetup } from "pleate/auth/two-factor-setup";Three steps
Confirm with 123456.
Step 1 of 3
Scan the QR code
Open your authenticator app (1Password, Google Authenticator, Authy…) and scan this code.
Can't scan it? Enter this key instead
JBSW Y3DP EHPK 3PXP JBSW Y3DPProps
- qrSvg / qrSrc
SVG markup (shown as an image data URL, never injected) or an image URL.
string- secret
The key for manual entry, shown in groups of four.
string- onVerify
Throw when the code is wrong; return the backup codes or pass backupCodes.
(code) => Promise<void | { backupCodes }>- backupCodes / onDone
Last step.
string[] / () => void- step / defaultStep / onStepChange
Control the step.
"scan" | "verify" | "backup"default "scan"- downloadName / downloadHeader
The downloaded text file.
stringdefault "backup-codes.txt"- error / codeLength
Controlled verify error; code length.
string / numberdefault none / 6- labels
Every visible string, for your wording or translation.
object
Accessibility
- The QR image has a text alternative and the key is always offered as text.
- Copy buttons announce "Copied".