Automation · APIs
Authentication
Cheat sheet · https://pcornel.dk/topic.php?topic=5311
Answer
Proof of client or user identity to an API before authorization evaluates access to resources and operations.
Remember
- Authentication success ≠ authorization granted; identity and access policy are separate boundaries.
- Credential present ≠ credential valid; expiry, audience, revocation and clock conditions can invalidate it.
- 401 ≠ always bad password/token; proxy, challenge, scheme or clock issues can produce the same class.
- Authenticated caller ≠ intended caller; shared credentials can obscure attribution and least privilege.
First checks
curl -sS -o /dev/null -w '%{http_code}' -H 'Authorization: Bearer <token>' <url>— auth works- Token source (vault, workload identity) — secret handling
- Least-privilege scopes — permissions
Verify in this order
credential → auth header/TLS → API authorises
Where it usually breaks
Successful authentication proves identity acceptance for that request; it does not prove authorization or target operation success.
Authentication 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=5311