Wiki · Concept · Last reviewed June 25, 2026

OAuth Client Credentials Grant

The OAuth Client Credentials Grant is the grant type for confidential clients that request access tokens using their own authenticated client credentials.

Definition

The OAuth Client Credentials Grant is the grant type defined in RFC 6749, The OAuth 2.0 Authorization Framework, edited by Dick Hardt and published in October 2012. It lets a client request an access token using only its client credentials, or another supported authentication method, when accessing protected resources under its own control or resources arranged with the authorization server.

RFC 6749 says this grant type must only be used by confidential clients. It is not a user-delegation ceremony. There is no resource-owner browser approval step, authorization endpoint redirect, user code, or authorization code. The client authentication itself is the authorization grant.

For AI agents, this is the pattern behind many service accounts, backend tool brokers, scheduled automations, model-evaluation workers, indexing jobs, and enterprise connectors that act as software principals rather than as a live end user.

How It Works

The flow is short. The client authenticates with the authorization server and requests an access token from the token endpoint. If the authorization server accepts the client authentication and request, it issues an access token. Since client authentication is the grant, no additional authorization request is needed.

The access token request is sent to the token endpoint as an application/x-www-form-urlencoded request. The required grant_type value is client_credentials. The optional scope parameter names the requested scope of access. RFC 6749 requires the client to authenticate with the authorization server, and requires the authorization server to authenticate the client.

If the request is valid and authorized, the authorization server issues an access token. RFC 6749 says a refresh token should not be included in a successful Client Credentials Grant response. The grant is for the client itself, so long-lived renewal should be handled through client credential lifecycle, token lifetimes, rotation, and policy rather than pretending there is an interactive user session to refresh.

OAuth Authorization Server Metadata can help clients discover the token endpoint, supported grant types, and token endpoint authentication methods. For this grant, those fields are operationally important because the client never visits the authorization endpoint.

Agent Context

Agent systems need both user-delegated and software-owned authority. A coding assistant acting on a developer's repository should often use user authorization. A nightly indexer, retrieval pipeline, compliance scanner, or managed tool gateway may instead need to act as a named service client with its own limits.

The Client Credentials Grant is useful when the agent is operating under organizational policy rather than a moment-by-moment human approval. That makes the identity boundary explicit: the actor is the client, not a hidden human account and not a vague model personality. The tradeoff is accountability. A broad client credential can make many automated actions look like one software principal unless the platform records agent run, workflow, operator, resource, and purpose.

This grant should not be used merely because a user flow is inconvenient. If a task needs to reflect a particular user's rights, consent, or audit attribution, a user-centered authorization flow is usually the safer starting point.

Governance and Safety

RFC 9700 says access token privileges should be restricted to the minimum required for the application or use case, and that access tokens should be audience-restricted to a specific resource server or a small set of resource servers when possible. Those recommendations are especially important for client-credentials tokens because there may be no human prompt to catch overbroad access.

Audit trails should preserve the issuer, token endpoint, client identifier, authentication method, credential key or certificate identifier, requested scope, granted scope, audience or resource indicator, token lifetime, policy decision, agent run, workflow owner, resource server, and revocation or rotation event. Logs should not store client secrets, private keys, access tokens, or full authorization headers.

Failure modes include shared service clients across unrelated agents, secrets baked into containers, broad default scopes, token reuse across resource servers, missing resource-server audience checks, no owner for the client, no rotation schedule, and emergency disable paths that are slower than the automation using the credential.

Defense Pattern

Source Discipline

Claims about the Client Credentials Grant should identify the authorization server, token endpoint, confidential client, authentication method, requested scope, issued token, audience, resource server, and policy basis. Do not collapse it into OAuth Token Exchange, user impersonation, OAuth Device Authorization Grant, service-account sprawl, or a legal conclusion that an end user consented.

Spiralist Reading

Spiralism reads the Client Credentials Grant as a machine signing for itself. No human hand appears at the moment of access. The institution has already decided that this software client may act within a defined corridor.

The corridor must be visible. If the client becomes a nameless tunnel through which every agent may pass, authorization has been replaced by convenience.

Open Questions

Sources


Return to Wiki