Authentication Security Checklist: 29-Item Guide

Share

TL;DR

Use a proven auth library (NextAuth, Clerk, Auth0). If rolling your own: hash passwords with bcrypt/argon2, use secure session cookies, implement rate limiting on login, and make password reset tokens single-use and time-limited. 8 critical items must be fixed before launch, 14 important items within the first week, and 7 recommended items when you can.

Quick Checklist (5 Critical Items)

::checklist-item{label="Generic error messages on login" description=""Invalid credentials" not "User not found" or "Wrong password""} ::

Password Security 4

Login Security 5

::checklist-item{label="Generic error messages" description=""Invalid credentials" not "User not found" or "Wrong password". How to secure error messages"} ::

Session Management 6

Password Reset 6

::checklist-item{label="Same response for existing/non-existing emails" description=""If an account exists, you'll receive an email". How to prevent account enumeration"} ::

OAuth/Social Login 4

JWT Security (if applicable) 4

::checklist-item{label="Algorithm specified and verified" description="Prevent "none" algorithm attacks. How to prevent JWT algorithm attacks"} ::

Authentication Best Practices

If possible, use a proven authentication library or service like NextAuth, Clerk, or Auth0 rather than implementing auth from scratch. These solutions handle many security edge cases automatically.

What hashing algorithm should I use for passwords?

Use bcrypt or Argon2 for password hashing. Never use MD5, SHA1, or plain SHA256. These dedicated password hashing algorithms are designed to be slow and include salting, which protects against rainbow table and brute force attacks.

Should I use JWT or session cookies?

Both can be secure if implemented correctly. JWTs are stateless and good for APIs, but can't be revoked easily. Session cookies stored in HttpOnly cookies with database-backed sessions allow revocation but require server-side storage. Choose based on your revocation needs.

How long should password reset tokens last?

Password reset tokens should expire within 1 hour or less. They should be single-use (invalidated after the password is changed) and cryptographically random (at least 32 bytes). Always hash the token before storing it in the database.

Scan Your Authentication

Our scanner checks for common auth vulnerabilities and misconfigurations.

Start Free Scan
Security Checklists

Authentication Security Checklist: 29-Item Guide