Client Credentials

The client credentials grant is used for machine-to-machine authentication where no user is involved.

Overview

This flow is for server-side applications that need to access resources on their own behalf, not on behalf of a user.

Use Cases

  • Background jobs

  • Microservice communication

  • API integrations

  • Scheduled tasks

  • System maintenance scripts

Flow Diagram

spinner

Token Request

POST /token

Headers

Header
Value

Content-Type

application/x-www-form-urlencoded

Authorization

Basic {base64(client_id:client_secret)}

Parameters

Parameter
Required
Description

grant_type

Yes

Must be client_credentials

scope

Optional

Space-separated scopes

Example

Response

circle-info

Client credentials grant does not return a refresh token since the client can always request a new token.

Authentication Methods

POST Body

Complete Examples

Node.js

Python

curl

Token Caching

Since client credentials tokens have no refresh token, cache them:

Scopes

Clients can only request scopes they're authorized for:

Security Considerations

circle-exclamation

Differences from Other Grants

Aspect
Client Credentials
Authorization Code

User involved

No

Yes

Refresh token

No

Yes

Use case

Service-to-service

User authentication

Client type

Confidential only

Both

Next Steps

Last updated

Was this helpful?