How should you store passwords?

Authentication and security · Freshers

Model answer

Never store plain text. Hash with a slow, salted algorithm such as bcrypt (or argon2) and store only the hash. On login, compare the entered password with the hash using bcrypt.compare. Never log passwords or return the hash in API responses.

Learn this topic

Login with JWT: Sign In, Issue a Token and Avoid Timing Leaks in the course MERN Stack Full Course: MongoDB, Express, React and Node.js.

Sign in to add your own answer.

More questions