In Keycloak, that’s where service accounts come in. They provide machine-to-machine authentication without any human credentials. A service account is tied to a client, not a person. It lets systems talk to each other securely, under strict scopes and roles.
What is a Keycloak Service Account?
A service account is an OAuth 2.0 client credential flow implementation inside Keycloak. When you create a client and enable "Service Accounts Enabled," Keycloak generates a dedicated user for that client. This user can be assigned roles in the realm or in specific client scopes. Requests can then use client_id and client_secret to gain a token.
How Service Accounts Work
When a client sends credentials to the token endpoint, Keycloak issues an access token representing the service account’s identity. Token life is controlled by realm settings. Roles define what APIs or resources the service account can access. There is no password rotation hassle—only the client’s secret or key pair determines access. All activity is logged, so tracing and audit are built in.
Why Use Service Accounts