You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
KeyConf26: Scalable API Keys without Keycloak Clients
#53988
The group wants API consumers to get by with an API key instead of a Keycloak client and the Client Credentials Grant. Group representative: Hanna Short (CERN)
Context
A system exposes an API. Every non-human consumer needs a confidential client in Keycloak to obtain tokens via the OAuth 2.0 Client Credentials Grant.
Many of these consumers are people writing scripts against the API.
Problems
The Client Credentials Grant is more complex than an API key, especially for the consumer. In return it is arguably more secure, because the long-lived credential (the client secret) is only sent to the identity provider, never to the API.
Client authentication is moving away from shared secrets towards stronger methods such as signed JWTs. This makes the consumer's burden even heavier.
From the consumer's point of view, "API + API key" should be enough. Instead they face an identity provider, a client registration and a grant.
Keycloak offers no alternative to the Client Credentials Grant for this use case.
Open questions
Can Keycloak issue API keys for APIs directly, as GitLab and many other products do?
How can Keycloak take part while validation on the API side stays as simple as with OAuth 2.0, for example validating a JWT?
What are the advantages and disadvantages of API keys compared with the Client Credentials Grant?
A. API keys in Keycloak. The group suggests pursuing the idea under this name, because it reflects the consumer's perspective.
Self-service similar to GitLab: a page and an API in Keycloak that list existing API keys and allow creating and revoking them.
Each key is bound to a client, carries scoped permissions and has an expiry date.
Keys must be opaque, not JWTs, so the API has to use token introspection. Open: is there another way to enforce Introspection?
Open: is this essentially the Client Credentials Grant exposed in the Account Console or Admin Console, with the resulting token serving as the API key?
Two entry points:
Personal (Account Console): what I as a user may do with an API.
Machine or client context (Admin Console, Clients): keys managed by administrators.
B. Simplify the Client Credentials Grant without API keys.
Ship a CLI or SDK that hides the grant, so client credentials feel like username and password.
In professional environments, the infrastructure registers the client, performs the grant and attaches the access token to each API call. This keeps the authentication method towards the identity provider replaceable instead of locking it to a password. Open: how realistic is this for the consumers in question?
Consider token exchange (RFC 8693) as a bridge: a gateway exchanges the opaque API key for a short-lived JWT. The API keeps validating JWTs, and introspection happens once per exchange instead of once per call. Discussion Static API keys with Keycloak Impersonation #45275 describes current limitations of this route.
Prefer an authoritative source (for example OWASP or an IETF document) over the Reddit thread.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
This was discussed as part of
The group wants API consumers to get by with an API key instead of a Keycloak client and the Client Credentials Grant.
Group representative: Hanna Short (CERN)
Context
Problems
Open questions
Sources and related GitHub issues
Solution approaches
A. API keys in Keycloak. The group suggests pursuing the idea under this name, because it reflects the consumer's perspective.
B. Simplify the Client Credentials Grant without API keys.
Next steps
Suggested improvements
All reactions