Pcornel
Automation · APIs

Authentication

Cheat sheet · https://pcornel.dk/topic.php?topic=5311

Back to the Topic

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

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind 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

Confirmation

Confirm action

Continue?