Back to results for “OAuth”
.NET › Authentication & Authorization (Identity, JWT, OAuth)

What is the OAuth 2.0 Client Credentials flow, and when is it used instead of the Authorization Code flow?

Intermediate

Answer

The Client Credentials flow authenticates the application itself (not an end user) using its own client ID and secret to obtain an access token, used for machine-to-machine communication like a backend service calling another API with no human user involved -- unlike Authorization Code flow, which represents delegated user authorization.
POST https://auth.example.com/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id=service-a&client_secret=***&scope=api.read
Real-world example A nightly batch job service authenticates to a partner's API using Client Credentials flow since it runs unattended with no user present to authorize anything, obtaining a service-level token scoped to just the permissions the job needs.

Common follow-ups: Why shouldn't client secrets ever be embedded in browser-based or mobile client code?;How does scope limiting reduce the blast radius of a compromised service credential?