Guide
Laravel Jetstream Livewire 2FA Not Prompting or QR Fails – Diagnostic Guide
Diagnose why Jetstream Livewire 2FA skips the OTP challenge, fails to show QR codes, or rejects valid codes with config, migration, key and session checks.
Published by Tasadduq Burney
16 Dec 2025, 22:54 UTC
3 min40.4K views0

Recognizable condition
A user enables two-factor authentication in the Jetstream Livewire profile screen, but subsequent logins skip the OTP challenge, the QR code does not render in the enrollment modal, or submitted codes are consistently rejected as invalid.
This guide assumes Laravel 9+ with Jetstream 2.x Livewire stack and Fortify for authentication. Steps differ for Inertia or React/Vue stacks.
Cause / diagnostic table
| Symptom | Likely cause |
|---|---|
| 2FA toggle missing or OTP step skipped on login | `two_factor` feature not enabled in Jetstream configuration |
| QR code does not render | Livewire component error or missing QR code generation dependency required by the installed Jetstream version |
| OTP verification always fails after enrollment | Missing `two_factor_secret` / `two_factor_recovery_codes` columns, or `APP_KEY` changed after enrollment |
| Challenge state lost between requests | Session or cache driver not persistent, e.g., `array` driver in a production-like flow |
Ordered checks
- Verify feature flag. Open
config/jetstream.php. Confirm thefeaturesarray includes'two_factor'for the Livewire stack. Clear config cache after changes:php artisan config:cache. Note: Fortify configuration is used by Jetstream internally; check version-specific documentation for any additional feature toggles. - Check database schema. Run
php artisan migrate:statuswhere to run: project root with appropriate permissions. Inspect theuserstable for columnstwo_factor_secretandtwo_factor_recovery_codes. Absence indicates missing Jetstream migrations. - Validate application key and persistence. Confirm
APP_KEYis set in.envand has not been rotated since users enrolled. Two-factor secrets are encrypted with the app key; rotation invalidates existing secrets. VerifySESSION_DRIVERandCACHE_DRIVERare persistent in the environment being tested, notarray. - Test enrollment rendering. In an incognito browser, enable 2FA on a test account. Observe whether the QR code element appears and whether the recovery codes are displayed. Open browser developer tools for Livewire JavaScript errors and check
storage/logs/laravel.logfor exceptions during the request.
Fixes tied to findings
- If the feature flag is missing, add
'two_factor'to thefeaturesarray inconfig/jetstream.phpand clear config cache. - If columns are missing, publish Jetstream migrations and run
php artisan migrate. Do not enable 2FA without recovery codes being generated and stored. - If
APP_KEYwas rotated, restore the original key or plan re-enrollment for affected users. Re-enrollment is required because encrypted secrets cannot be recovered after key change. - If session/cache is non-persistent, change to a persistent driver such as
file,redis, ordatabaseand clear caches:php artisan cache:clear. - If QR code does not render, verify the QR code generation dependency required by your Jetstream version is installed and frontend assets are built. Dependency names vary by version; consult the version-specific Jetstream documentation rather than assuming a package.
Escalation criteria
- Configuration, migrations,
APP_KEY, and drivers are correct but the challenge still does not appear or verification fails. - Capture browser console Livewire errors and
storage/logs/laravel.logentries from a test enrollment and login attempt. - Provide a minimal reproduction with Laravel, Jetstream, PHP versions and relevant config snippets before contacting support or filing a bug.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.