DEV Community

Muzzamil Ahmed Khan
Muzzamil Ahmed Khan

Posted on

I built a WordPress two-factor authentication plugin — here is what I learned

After working as a freelance WordPress developer for international clients since 2022, I kept seeing the same thing: business websites running on passwords alone.

Two-factor authentication plugins existed, sure — but most either forced a single method on every user or had setup flows so painful that site owners would install them and never finish configuring.

So I built my own: Muzzamil Two-Step Login Security. It's now live on the WordPress.org plugin directory and launching on Product Hunt.

The core idea: let users choose their own second factor

Most 2FA plugins say "use THIS method." Mine says "pick what works for you":

  • Authenticator apps — scan a QR code, get 6-digit codes from Google Authenticator, Authy, Microsoft Authenticator, or any TOTP app (RFC 6238)
  • Social login — connect Google, Microsoft, or Facebook once, then sign in with one click. No codes to type.

Each user picks their own method. An admin can require 2FA site-wide, but individual users still choose how they verify.

The security details that matter

This is a security plugin, so the boring parts had to be right:

  • TOTP secrets encrypted with AES-256-GCM before hitting the database
  • Recovery codes stored as salted hashes — never plaintext, so a database leak doesn't hand attackers working backup codes
  • OAuth flows use state tokens + PKCE + browser-bound HttpOnly cookies, with single-use state deletion
  • Rate limiting on all authentication attempts
  • Follows WordPress Coding Standards — passes PHPCS with zero warnings

The UX details that sold me

The technical stuff is table stakes. What I obsessed over:

  • QR enrollment completes in under a minute
  • Social login happens in a popup with a congratulations countdown, then redirects the original tab — no jarring full-page navigation
  • Failed logins show clear, non-technical error messages
  • The admin dashboard is fully branded with a custom setup flow, not just default WordPress screens

What I learned building it

  • WordPress.org review is thorough. The plugin was reviewed line-by-line — security architecture, escaping, capability checks, uninstall cleanup. It made the plugin better.
  • OAuth is harder than it looks. Popup blockers, cross-origin restrictions, and state validation took real iteration.
  • Per-user choice beats forced methods. Forcing everyone into TOTP locks out less-technical users; offering social login catches the rest.

Try it

It's free, open source, and works on WordPress 6.0+ / PHP 7.4+. If you run WordPress sites — or you're building your first plugin — I'd genuinely love your feedback, especially on the setup flow.

What made you pick (or avoid) a 2FA plugin for your sites?

Top comments (0)