A client in Keycloak represents an application that requires authentication and authorization. Clients can be:
Each client in Keycloak is registered under a realm and can use OpenID Connect (OIDC) or SAML for authentication.
Keycloak issues JWT tokens to clients after authentication. Tokens contain:
iss
) → Keycloak realm URLsub
) → Unique User IDaud
) → The client the token was issued forexp
) → Token validity periodrealm_access.roles
) → User permissions🚀 Example JWT Structure:
{
"iss": "<https://keycloak.example.com/realms/my-realm>",
"sub": "USER_ID",
"aud": "web-client",
"exp": 1717651200,
"realm_access": {
"roles": ["USER", "ADMIN"]
}
}
✅ The aud
field ensures tokens are validated against the correct client.