React
Enrollment
At the end of this guide, you will have a complete 2FA enrollment flow where users can scan a QR code, verify with their authenticator app, receive recovery codes, and manage their 2FA settings.
The enrollment component provides a self-service flow for users to enable two-factor authentication from their profile page. Users scan a QR code (or enter the secret manually), then verify by entering a 6-digit code from their authenticator app. Upon successful verification, 10 single-use recovery codes are generated and displayed once. Users who have 2FA enabled can regenerate their recovery codes or disable 2FA entirely.
The component includes:
- Two-factor section on the profile page showing current 2FA state
- QR code enrollment page with manual secret fallback
- Code verification to activate 2FA
- One-time recovery codes display after enrollment
- Regenerate recovery codes for users with 2FA enabled
- Disable two-factor authentication
Note
This guide requires you to complete the Two-Factor Setup guide first.