JWT

A JSON Web Token: a base64url header, payload and signature joined by dots. The signature proves the claims were issued by someone holding the key and have not changed. The payload is readable by anyone, so it must never hold secrets.

Minimal example

go
jwt.NewWithClaims(jwt.SigningMethodHS256, claims).SignedString(secret)

Learn this concept

Lesson 3.2 · JWT and refresh token rotation

Used in exercises

Exercise 3.3 · POST /v1/auth/*: signup, login and refresh Exercise 3.5 · GET /v1/me: caller account Exercise 5.3 · Per-user WebSocket hub Exercise 6.14 · Admin order statistics