Client Credentials Flow
Use Client Credentials Flow to enable secure, machine-to-machine communication between services and applications without requiring a user.
What is Client Credentials Flow?
Client Credentials Flow allows applications or services to authenticate themselves with an authorization server to get an access token. It’s used in scenarios without a user, such as batch processing or system integration in machine-to-machine environments.
Only confidential clients that can securely store credentials can use this flow.
How Client Credential Flow works
The client application uses client authentication as its authorization grant, and no additional authorization is needed.
Client Authentication. Application authenticates itself to the authorization server using its credentials.
Token Request. Client sends a POST request to the token endpoint to get an access token.
Sample call to the token endpoint:
curl -X POST https://$TENANT_ID.$REGION_ID.authz.cloudentity.io/$TENANT_ID/$WORKSPACE_ID/oauth2/token \ --header "Content-Type: application/x-www-form-urlencoded" \ --data-raw "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET"
Region ID notesREGION_ID
is available for recently created tenants in the tenant URL next to TENANT_ID. The region IDs are assigned as follows:If the tenant URL doesn't include a region identifier, omit the
REGION_ID
parameter.Australia:
au
Europe:
eu
USA:
us
Authorization Server Validation. Server checks the credentials and responds with an access token.
Resource Access. Client uses the token to request resources from the resource server.
Resource Validation. Resource server validates the token and grants access.
Best practice
Scope Management. Limit the client's access scope when calling the
/token
endpoint. This ensures the client only requests what it needs.