Automation · APIs
OAuth 2.0
Cheat sheet · https://pcornel.dk/topic.php?topic=5315
Answer
Delegated authorization framework for obtaining and using access tokens through defined grant flows and client roles.
Remember
- OAuth 2.0 ≠ authentication by itself; OpenID Connect adds standardized identity semantics on top.
- Access token ≠ refresh token; they have different audience, lifetime and handling requirements.
- Authorization Code flow ≠ Client Credentials flow; user delegation and machine identity solve different problems.
- Token issued ≠ API access guaranteed; audience, scope and resource policy still control authorization.
First checks
curl -sS -X POST <token-url> -d grant_type=client_credentials -d client_id=<id> -d client_secret=<secret> -d scope=<scope>— client credentials flow- Token caching until expiry — efficiency
- Scopes granted to client — least privilege
Verify in this order
client → token endpoint → access token → API
Where it usually breaks
OAuth token issuance proves the authorization server accepted a grant; it does not prove identity semantics or resource-server authorization.
OAuth 2.0 API boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Caller / request | Environment/version, identity and exact request contract are attributable | Hidden defaults, wrong endpoint/version, leaked or mismatched credentials |
| Server / response | Status, headers, structured body and request ID are interpreted together | Status-only handling, ignored error body, ambiguous async result or unsafe retry |
| State / proof | Write result is reconciled with resource read-back or acceptance test | Response success treated as final target success without verification |
| Troubleshooting | First failed boundary is preserved, changed minimally and retested | Blind retries, credential rotation, replay or payload edits before evidence is captured |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5315