A self-contained token carries the metadata, claims, and signature needed for an API to validate a bearer access token offline. JWT is the most common format. section 25.2
Its main tradeoffs are:
- Offline validation avoids an issuer round trip, but the token cannot normally be revoked and therefore usually has a limited lifetime. section 25.2
- Including many claims can make requests larger. section 25.2
- A reference token offers revocation and keeps claims away from the client, but requires an issuer request for every API request. section 25.2
JWT authentication flow
An API receives a bearer JWT, verifies its signature, and lets authentication middleware validate and deserialize it into a ClaimsPrincipal assigned to HttpContext.User.
