liveBook · Manning

Client credentials grant type

As explained in ASP.NET Core in Action, 3e

The client credentials grant is an OAuth 2.0 flow in which an application authenticates as itself to obtain authorization for machine-to-machine access.

The client credentials grant is an OAuth 2.0 flow for machine-to-machine access. An application authenticates as itself to obtain authorization for calling a protected API, without a user interaction. section 25.7 section 25.1.3

Choose the grant type according to who initiates the access:

  • Use client credentials when one API needs to call another API and no user is involved. section 25.1.3
  • Prefer authorization code with PKCE for an interactive flow initiated by a user. section 25.7 section 25.1.3
  • Treat other OAuth 2.0 grants as alternatives when the scenario does not match these common flows. section 25.1.3

A machine-only workflow

A scheduled service requests authorization and calls another API on its own behalf. Because no person initiates or consents to the interaction, client credentials fits the workflow. section 25.7

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines the scenario and contrasts common grant types, but does not detail token-request implementation.
Examples
Uses an API calling another API as the representative machine-only example.
What you can do after
Evaluate whether a machine-only API interaction requires the client credentials grant rather than an interactive grant.
How it connects
Connects OAuth 2.0 with authorization code flow, PKCE, identity providers, and OpenID Connect.

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 ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.