Learn

2FA: a second proof beyond the password

Two-factor authentication (2FA) requires two independent proofs to log in, not just one: typically something you know (a password) plus something you have (a phone or security key). The point is that a stolen password alone no longer gets an attacker in.

At a glance

What it is
Two independent proofs of identity required to log in
The usual second factor
A time-based one-time password (TOTP), a six-digit code that rotates
Why it matters
A leaked or guessed password alone is no longer enough
What it is not
Two passwords; both factors must be different in kind
Flow

A login with 2FA

The password is the first factor. The rotating code from your phone or a security key is the second. An attacker with only the password stops at the second gate.

1
Something you know the password, the first factor
2
Something you have a phone code or security key, the second factor
3
Access granted only when both factors check out

What are the two factors?

Two-factor authentication (2FA) means a login needs two proofs of different kinds. The classic split is something you know, your password, plus something you have, a phone or a hardware security key. The two must be different in kind: two passwords are not 2FA, because one leak compromises both. The value is that a password caught in a breach, reused from another site, or shoulder-surfed is no longer the whole story. The attacker still needs the thing in your pocket.

For a self-hosted setup, the accounts worth protecting this way are the ones that can hurt you: the code host, the domain registrar, the cloud provider holding a public server. Those are exactly the accounts attackers go for, because they are the lever to everything downstream.

What is a TOTP code?

The common second factor is a time-based one-time password (TOTP): the rotating six-digit code an authenticator app shows. The app and the server share a secret once, at setup, and from then on both compute the same code from that secret plus the current time. The code changes every thirty seconds, so a captured one is stale almost immediately, and nothing has to travel over the network to deliver it.

A hardware security key is stronger still, since it cannot be phished the way a code typed into a fake page can. SMS codes are the weakest common option: a text message can be intercepted, and the number it goes to can be ported away from you. Better than nothing, but the first choice when a service offers more.

Stronger second factors

  • A hardware security key you physically tap
  • A time-based one-time password (TOTP) from an authenticator app
  • A push approval tied to a registered device

Weaker or non-factors

  • A second password; it is the same kind of secret, not a second factor
  • An SMS code, interceptable and tied to a number that can be ported away
  • A security question whose answer is often public or guessable

Related terms

← All terms Reviewed: June 2026