Automation · APIs
Bearer Tokens
Cheat sheet · https://pcornel.dk/topic.php?topic=5314
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
| 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=5314