Node.js FAQ: Top Questions
37. What is JWT authentication in Node.js?
JWT authentication in Node.js uses JSON Web Tokens to securely authenticate users, encoding user data in a token verified by the server.
-
Structure:
Header, payload, signature (e.g.,
eyJ...
). -
Libraries:
jsonwebtoken
for signing/verifying. - Process: Issue token on login, verify on protected routes.
- Use Case: Stateless API authentication.