OAuth 2.0, OpenID Connect, and JWTs in about an hour — run Keycloak locally, build a realm and client by hand, decode a real access token, and protect a NestJS API with it.
Keycloak is an open-source Identity and Access Management (IAM) system — it owns login, password storage, and token issuing so your apps don't have to reinvent them. This series is a self-contained crash course: what Keycloak is, how to run it locally in Docker, how OAuth 2.0 and OpenID Connect fit together, and how to protect a real NestJS API with the tokens Keycloak issues.
By the end you'll have a working Keycloak realm with a client and two test users, and a NestJS API with a public route, a token-protected route, and a role-protected route — validating real Keycloak-issued JWTs.
This series covers the ground needed for one protected API, not everything Keycloak can do — see the final chapter for what's deliberately left out. See the source repository for the runnable reference app.