with the receiver • The sender calculates the signature by hashing the data and encryp7ng it with his private key • The receiver validates the signature by decryp7ng the signature with the public key of the sender and compare the hash
can generate a valid signature • Integrity: You can't change the JWT data without regenera+ng a new signature • No secrecy! Alterna+ve: JSON Web Encryp+on (JWE)
unique session id 3. Session informa0on is stored server side 4. Responds with cookie containing session id 5. On every request the session and user data is fetched from the database/redis
response with a JWT iden0fying the user 3. On every request the client sends the received JWT in the Authoriza0on header 4. The server verifies the JWT by checking the signature
No database calls to validate the access token, get the user id, scopes, ... • Possibility to have shared tokens across mul<ple micro-services • The client can check if the token is expired
keep a list of tokens to revoke • Best prac9ce to have short TTL • The more embedded data, the bigger the JWT. No fixed size. • Not encrypted, unless you use JWE • Token data can go stale
(league/oauth2-server) • Separated OAuth2 micro-service, accept access tokens across micro-services API's • Marketplace shares user informaGon between frond/back-end using a JWT