Authentication, Passwords, and Account Recovery

Authentication establishes who signed in. The same account can often be reached through a password, a passkey, or a recovery flow. Each entry point needs protection.

On this page

Store a password verifier

Use a maintained password library with a slow password hash such as Argon2id. Let it generate a unique salt and store the encoded result including the work settings. At login use its verify function. Choose a cost your service can sustain and increase it over time. The example shows the library workflow in pseudocode.

registration: encoded = passwordLibrary.hash(password, algorithm="argon2id")
login:        valid = passwordLibrary.verify(encoded, submittedPassword)

Use independent authentication factors

Multifactor authentication (MFA) combines independent factors such as a password and possession of a registered authenticator. A second password is still the same factor. For sensitive accounts, offer phishing-resistant passkeys with user verification. Protect factor enrollment and replacement with reauthentication and notify the owner of changes.

Knowledge    Account password
Possession   Registered security key or authenticator
Recovery     Single-use backup codes stored securely by the owner

Protect sign-in and recovery together

Use throttling and offer phishing-resistant authentication such as WebAuthn passkeys. For a reset request, return the same public message and comparable response timing whether the email exists or not. Deliver a random, expiring, single-use token through the verified recovery channel. After reset, notify the owner and revoke existing sessions according to policy.

Public response    If the account exists, recovery instructions will follow.
Recovery token     Random, short-lived, single use
Sensitive change   Reauthenticate before changing the recovery address

Official references