When No Human Is There to Click “Allow”
Most people meet OAuth through a login screen. But a lot of integration work has no user at all, like a job that syncs reports every night. For this, OAuth has a separate flow called client credentials: your app acts for itself, not for a person.
How it works: one request
Your server sends its client ID and client secret to the provider’s token endpoint, and gets an access token back. No redirect, no browser, no consent screen. Then it calls the API with "Authorization: Bearer <token>".
POST /token HTTP/1.1
Host: auth.example.com
Authorization: Basic <client_id:client_secret in Base64>
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=reports.readExample request, the shape and not a real endpoint, following RFC 6749 section 4.4.2. Some providers want the ID and secret in the body instead.
There is no refresh token here, because your server can ask for a new token any time. Keep the token and its expiry, and get a new one when it runs out. Not for every call.
When to use it, and when not
- Use it for your own company’s data: nightly syncs, reports, back-office jobs.
- It cannot act as a user. For a specific user’s data, use the flow where the user approves.
- Only on a server. A mobile app or web page cannot keep the secret.
- Guard the client secret like a password: a secret manager, narrow scopes, and a plan to rotate it.
Do this in 60 secondsPick one scheduled job. Does it need a person’s data, or only the company’s? If only the company’s but it uses a person’s token, write it down. That token breaks the day that person leaves.
Today’s AI angleA nightly AI agent that writes a report summary fits client credentials. An agent that drafts emails for one user needs that user’s approval. An app-wide token would let it see every user’s data.