gabrielesbaiz/nova-two-factor
Adds two-factor authentication to Laravel Nova. Protect your admin panel with TOTP-based 2FA: users enroll authenticator apps, verify one-time codes at login, and manage recovery codes from a familiar Nova interface. Lightweight and easy to install and configure.
Architecture fit
gabrielesbaiz/nova-two-factor is a Laravel Nova add-on that layers TOTP-based two-factor authentication onto Nova's own authentication flow, rather than the application's primary user login. Architecturally this makes it a narrow, high-leverage dependency: it touches a small surface (Nova login, user menu, middleware) but sits directly on the administrative control plane, which is typically the highest-privilege surface in the estate. It fits well where Nova is already the back-office/admin UI and where the primary product auth is handled elsewhere (Fortify, Breeze, SSO). It is a poor fit where 2FA is expected to be a single, unified policy across both end-user and admin logins — in that case this package duplicates rather than consolidates controls, and the TPM should expect two enrolment journeys, two recovery-code stories, and two audit trails.
Integration feasibility Low-to-moderate. It is a Composer package with Nova as a peer dependency; integration is install, publish config/migrations, and register the middleware/tool in the Nova service provider. The real integration work is not code — it is identity lifecycle: enrolling existing admins, defining recovery-code custody, deciding enforcement (forced vs. opt-in) per role, and aligning with whatever IdP/SSO story exists. If SSO with MFA is already in place for staff, this package may be redundant and the honest recommendation is to consolidate on the IdP rather than add a second factor silo.
Technical risk The dominant risk is release opacity, not code quality. Release 2.2.0 ships with an empty changelog body — only a comparison link between 2.1.2 and 2.2.0. Semver implies a minor, backward-compatible change, but that is an inference, not a documented guarantee. Secondary risks: single-maintainer package (bus factor), tight coupling to Nova's internal auth/login views (Nova major upgrades are the most likely breakage vector), and security-sensitive behaviour (TOTP secret storage, recovery-code hashing, rate limiting on verification) that a TPM cannot validate from release notes alone. Treat the 2FA secret store as a compliance-scoped data asset from day one.
Key questions
mustUseTwoFactor), and can enforcement be scoped to specific roles or guard contexts?Stack fit
Fits a standard Laravel + Nova stack with MySQL/Postgres, no specialised infrastructure. No external service dependency (TOTP is local), which is attractive for air-gapped or data-residency-constrained deployments — the factor never leaves our infrastructure. Verify PHP and Laravel version constraints in composer.json against our runtime before committing.
Migration path Because this is a new dependency, the "migration" is an enablement programme rather than a data migration: (1) install and publish in a non-production Nova environment; (2) diff published config against defaults and commit an explicit, reviewed config; (3) run migrations for the 2FA columns/tables; (4) pilot with a small admin cohort; (5) backfill enrolment for remaining admins; (6) flip enforcement on. The only true data-migration concern is if we later replace this with IdP-based MFA — plan the secret-export/deprovision path now, or accept a re-enrolment event at that time.
Compatibility
Pin the version explicitly in composer.json (e.g., ^2.2) rather than relying on a floating constraint, and record the Nova major version it was validated against. The known fragility is Nova upgrades; establish a standing rule that Nova major upgrades trigger a mandatory regression test of the 2FA login, enrolment, and recovery flows before rollout.
Sequencing Pin and diff the 2.2.0 changes first — this gates everything. Then evaluate in a sandbox Nova instance; then define the enforcement policy and recovery-code custody model (this is a security-owner sign-off, not a TPM decision); then pilot; then enforce; then add the control to the compliance evidence pack. Do not sequence enforcement before the recovery workflow is tested with a real admin who has "lost" their device.
Maintenance Low code maintenance, moderate process maintenance. Budget for: dependency-review on each release (2.2.0 alone demonstrates why — an empty changelog means a human must read the diff), Nova-version compatibility checks roughly annually, and a quarterly review of the enrolled-admin roster versus active staff. Single-maintainer status means we should hold a fork-ready posture: keep our config and any local overrides in our own repository so we can patch or vendor quickly if upstream stalls.
Support Support load concentrates in two predictable queues: enrolment friction (QR/authenticator issues, clock skew on TOTP) and lockout recovery. Publish a one-page runbook covering both, name an owner for recovery-code resets, and ensure the helpdesk can verify identity for a reset without creating a social-engineering bypass of the very control we added. Expect a small spike at enforcement go-live and steady-state near zero.
Scaling Effectively free — TOTP verification is a local HMAC computation with no network hop or per-seat cost. Scales with the admin user base, which is small by definition. No licence implications beyond the existing Nova licence. No consideration at all for end-user-scale traffic, since the package only guards Nova routes.
Failure modes
Ramp-up Genuinely fast for engineers — the package is small and conventional, and a Laravel developer can read the whole thing in under an hour. The longer ramp is organisational: security sign-off on the storage model, HR/comms for the enforcement rollout, and helpdesk training on recovery. Plan for a two-to-three-week elapsed enablement window from sandbox install to enforced production, most of it waiting on pilot feedback and sign-off rather than engineering effort.
How can I help you explore Laravel packages today?