JWT (JSON Web Token)
When you log in, your server creates a JWT. It's a string that looks like gibberish but contains your user ID, an expiry time, and a cryptographic signature. Every time you make a request, you send this token. The server reads it, verifies the signature, and knows who you are โ without looking you up in a database every time.
The three parts: Header (type + algorithm) . Payload (your data) . Signature (proof nobody tampered with it). Separated by dots.
Why it matters: JWTs let your server be "stateless" โ it doesn't need to remember who's logged in because the proof of identity travels with every request.
How it works
Client โ Server: "Here's my email + password" Server โ Client: "Here's your JWT (valid 7 days)" Client โ API: "Here's my JWT" (every request) API: Reads JWT โ verifies signature โ knows who you are โ No database lookup needed