TwoFactorEnrollment
TOTP enrollment wizard. Two visual steps:
-
Enroll — calls
setupTwoFactor, shows the provisioning URI (rendered as a QR code via a quick external charts service) and the base32 secret as a fallback for users without a QR scanner. -
Confirm — collects the first 6-digit code from the authenticator app and calls
enableTwoFactor. The server stampstwo_factor_confirmed_atonly after a valid code, so this step is required (skipping it = “setup but not enforced” state, harmless but useless).
The QR code is generated by Google Chart API as a tiny static URL —
no client-side QR library dependency. Swap by passing renderQr.
Usage
import { TwoFactorEnrollment } from '@rw3iss/auth-client/preact/forms';
<TwoFactorEnrollment onComplete={() => navigate("/login")}/>Props
| Name | Type | Description |
|---|---|---|
client | AuthClient | |
renderQr | (uri: string) => ComponentChildren | Custom QR renderer; receives the otpauth:// URI. |
onComplete | () => void | |
className | string |