What is a JWT and how is it used for login?
Model answer
A JSON Web Token is a signed string with a header, payload (claims such as user id and expiry) and signature. After login the server issues it, the client sends it with later requests, and the server verifies the signature and expiry. The payload is encoded, not encrypted, so never put secrets in it.
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.