Lion Cipher Lab

Run the OAuth 2.0 Client Credentials flow (machine-to-machine) against Keycloak

Why it matters

Not every OAuth flow logs a person in. A huge amount of real traffic is one backend talking to another with no human anywhere — a nightly batch job calling an internal API, a payments service calling a ledger, a CI pipeline pushing to a registry. The OAuth 2.0 Client Credentials grant (RFC 6749 §4.4) is the standard, correct way to do that: the service authenticates as ITSELF using its own credentials and gets an access token scoped to what it is allowed to do. Getting this right — and knowing where it does NOT belong — is table stakes for any identity, backend, platform, or cloud role. In…

What you'll learn

Steps in this lab

  1. The flow with no user in it
  2. Start a real authorization server: Keycloak in Docker
  3. Create a realm and a CONFIDENTIAL client
  4. Enable the service account (this IS the client credentials grant)
  5. Get a token: POST grant_type=client_credentials to /token
  6. Decode the token and read the machine-identity tells
  7. Prove the token is real: introspect it
  8. When to use it, when NOT to, and the pro way

Open the full interactive lab →