---
title: "Two-factor authentication (2FA)"
description: "Two-factor authentication (2FA): the factor types, how TOTP codes work, which methods are more or less secure and how to set it up on WordPress."
language: "en"
locale: "en-US"
type: "definition"
canonical: "https://www.wp-feint.com/glossary/two-factor-authentication/"
published: "2026-10-28T08:00:00+00:00"
modified: "2026-11-22T12:07:12+00:00"
translations:
  en-US: "https://www.wp-feint.com/glossary/two-factor-authentication/index.md"
  fr-FR: "https://www.wp-feint.com/fr/definitions/double-authentification/index.md"
  es-ES: "https://www.wp-feint.com/es/glosario/autenticacion-de-dos-factores/index.md"
  de-DE: "https://www.wp-feint.com/de/glossar/zwei-faktor-authentifizierung/index.md"
  it-IT: "https://www.wp-feint.com/it/glossario/autenticazione-a-due-fattori/index.md"
  pt-BR: "https://www.wp-feint.com/pt/glossario/autenticacao-de-dois-fatores/index.md"
  nl-NL: "https://www.wp-feint.com/nl/woordenlijst/tweefactorauthenticatie/index.md"
---

# Two-factor authentication (2FA)

Two-factor authentication (2FA) adds a second proof of identity to the password at login: a temporary code generated by an app, a security key or a notification on a trusted device. A stolen or guessed password is then no longer enough to get into the account.

It is also called two-step verification or, more broadly, multi-factor authentication (MFA). The idea is to stop betting everything on a secret that can be guessed, reused or stolen. Even if the password falls into the wrong hands, the attacker is stopped at the second step, which requires an object or a trait they don't have.

## The three types of factors

NIST's digital identity guidelines (SP 800-63B), like most security guidance, use the usual classification:

- **Something you know** (knowledge): password, passphrase, PIN.
- **Something you have** (possession): a phone with an app that generates codes, a security key, a smart card, a passkey.
- **Something you are** (inherence): fingerprint, face.

For there to really be two factors, they must come from two different types. A password followed by a security question is still single-factor authentication, since both rely on knowledge.

## How a TOTP code works

The most common method on websites relies on the TOTP algorithm, standardized in RFC 6238. During setup, the site and the phone app share a secret, usually transmitted through a QR code. Afterward, each one computes a code on its own from that secret and the current time, in 30-second steps by default. The site doesn't need to contact the phone: if both computations match, the person really holds the secret.

![Five-step login with a TOTP code: the user enters their password, the site verifies it and then asks for a code, the phone app computes the code from a shared secret and the time, the user types in the code valid for 30 seconds, and the site computes the expected code before opening the session](https://www.wp-feint.com/media/2026/10/double-authentification-totp-en.webp)

*Video: “What is Two-Factor Authentication? (2FA)” (Duo Security)*

## Methods, from weakest to strongest

- **Code by text message or email**: better than nothing, but only as secure as the phone line or the inbox. NIST classifies SMS codes as a “restricted” authenticator because of these risks.
- **TOTP app** (Google Authenticator, Microsoft Authenticator, Aegis, 2FAS…): works offline, with no dependence on the carrier.
- **Security keys and passkeys** (WebAuthn): tied to the site's domain name, they resist [phishing](https://www.wp-feint.com/glossary/phishing/) far better, whereas a TOTP code can be typed into a fake site.

Always plan a fallback: single-use recovery codes, kept somewhere other than the phone.

## For WordPress

WordPress doesn't include two-factor authentication: its documentation recommends adding it through a plugin or an identity provider, at least for administrators. It is the most effective defense against [brute-force attacks](https://www.wp-feint.com/glossary/brute-force-attack/) and [credential stuffing](https://www.wp-feint.com/glossary/credential-stuffing/). A few things to check:

- make it mandatory by role, not just optional;
- cover the other entry points too: since WordPress 5.6, application passwords are used by tools that connect to the REST API or [XML-RPC](https://www.wp-feint.com/glossary/xml-rpc/); a protected account shouldn't accept its main password there;
- keep the plugin up to date: a vulnerability can bypass the second step, as the [Really Simple Security case](https://www.wp-feint.com/really-simple-security-cve-2024-10924-2fa-bypass/) showed.

[WP Feint Pro's two-factor authentication](https://www.wp-feint.com/features/two-factor-authentication/) uses TOTP codes generated on your own site, with no external service, ten backup codes, enforcement by role and restriction of XML-RPC and REST API logins to application passwords for protected accounts. Our guide to [TOTP, backup codes and passkeys](https://www.wp-feint.com/wordpress-two-factor-authentication/) compares the options in detail.

## Common mistakes

- Losing your phone without having saved your backup codes.
- Letting the phone's clock drift: TOTP codes are then rejected.
- Believing two-factor authentication protects a session that is already open: it stops neither an XSS flaw nor the theft of a session cookie.

## Related terms

- [Brute-force attack](https://www.wp-feint.com/glossary/brute-force-attack/)
- [Credential stuffing](https://www.wp-feint.com/glossary/credential-stuffing/)
- [Phishing](https://www.wp-feint.com/glossary/phishing/)
- [XML-RPC](https://www.wp-feint.com/glossary/xml-rpc/)
- [bcrypt hashing](https://www.wp-feint.com/glossary/bcrypt/)


## Sources

- [NCSC: Multi-factor authentication for your corporate online services](https://www.ncsc.gov.uk/collection/mfa-for-your-corporate-online-services)
- [RFC 6238: TOTP, Time-Based One-Time Password Algorithm](https://www.rfc-editor.org/rfc/rfc6238)
- [WordPress Advanced Administration: Brute Force Attacks](https://developer.wordpress.org/advanced-administration/security/brute-force/)
- [WordPress REST API Handbook: Authentication](https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/)
