liveBook · Manning

Client credentials grant type

As explained in Secure APIs

The client credentials flow is an OAuth authorization flow in which a client authenticates with its own credentials to obtain an access token without user interaction.

The client credentials grant is an OAuth flow for machine-to-machine communication. A nonhuman client directly exchanges its own credentials with an authorization server for an access token, without a browser or repeated user consent. section 7.4.3

Use this flow when the API consumer is a service rather than a person:

  • Run automated API calls, such as requests made during continuous integration. section 7.4.3
  • Connect services to third-party APIs for email delivery, geolocation, or payment processing. section 7.4.3
  • Authenticate internal services communicating across a distributed architecture, such as microservices. section 7.4.3

Scheduled publishing service

A server-side application registered to publish posts on a schedule receives authorization when it is registered. It can then obtain tokens directly whenever it needs to call the API, rather than opening a browser and requesting consent each time. section 7.4.3

Figure 7.8 In the client credentials flow, a server-side application directly exchanges credentials for an access token. If necessary, the resource owner gives consent upon registering the client with the authorization server.
figure

Trace the direct exchange from a server-side application’s credentials to an access token, including registration-time consent when needed. section 7.4.3

How Secure APIs covers it

How deep it goes
Explains the actors, direct token exchange, browser absence, and registration-time consent without detailing credential formats or implementation code.
Examples
Uses continuous integration, email, geolocation, payment processing, microservices, and scheduled social-media publishing.
What it assumes
Assumes familiarity with APIs and authorization while explaining the machine-to-machine constraint from first principles.
What you can do after
Apply it to select a browserless OAuth flow for automated jobs, service integrations, and internal service calls.
How it connects
Connects OAuth, authorization code flow, access tokens, authorization servers, consent, and microservices.

Also explained in

Compare how 5 books explain client credentials grant type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Secure APIs. The section links point to the parts of the book it draws on.