Pcornel
Automation · APIs

Bearer Tokens

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

Back to the Topic

Answer

Possession-based access tokens transmitted with API requests and validated for lifetime, issuer, audience, scope and policy context.

Remember

  • Bearer token possession ≠ caller identity proof at use time; whoever holds the token can usually present it.
  • Token decodes ≠ token valid; signature, expiry, issuer, audience and revocation/introspection still matter.
  • Scope claim present ≠ operation authorized; resource-side policy can add constraints.
  • Token refresh success ≠ previous access token revoked; token lifetimes and revocation are separate.

First checks

  • curl -sS -H "Authorization: Bearer $TOKEN" <url> — bearer call
  • Token expiry handling (refresh) — continuity
  • Audience/scope of token — least privilege

Verify in this order

token → Authorization header → API validates

Where it usually breaks

A bearer token proves possession of a credential artifact; validity, authorization and final operation outcome require separate checks.

Bearer Tokens 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=5314

Confirmation

Confirm action

Continue?