Authenticate a local API client
Status: Ready
Article ID: 103
Truth label: Current
Audience: Integrator
Reader outcome: Use local-or-token access without placing tokens in examples.
Related articles: 061, 062, 070
Target week: 41
Last verified: 2026-09-13
Technical reviewer: Codex security and API audit
Editorial reviewer: Codex editorial audit
Choose the intended boundary
For one host, keep the service on loopback. For an approved private-LAN client, configure the fleet bearer, exact origin where a browser is involved, firewall scope, and protected transport.
Keep examples secret-free
Use a token token such as <FLEET_TOKEN> in documentation. Load the real value
from an approved secret source at runtime and set the documented authorization
header. Never paste a live bearer into code, task text, screenshots, or logs.
Test both outcomes
Call a non-sensitive health route first. Then confirm a protected route succeeds with the approved client and fails with a missing or synthetic bad bearer. Use a read-only route and synthetic environment for the negative check.
Handle failures
Distinguish unauthorized, forbidden, wrong host, CORS, TLS, and network failures. Repeatedly sending a rejected secret cannot repair a configuration mismatch. Rotate any bearer that may have been logged or shared.
Current limits
Bearer authentication proves possession, not operator role, tenant identity, or safe execution. A process on the same host may reach loopback, and Cortex local storage creates browser-origin exposure.
Next lesson
Continue with Build a task from an API request.
Derivative map
- Weekly package: WEEK-41
- Long video: VIDEO-W41-LONG
- Shorts: SHORT-W41-PROBLEM, SHORT-W41-MECHANISM, SHORT-W41-WARNING
- Email: EMAIL-W41
- LinkedIn: LI-W41-A, LI-W41-B
- X: X-W41-A, X-W41-B
- Visual: VISUAL-W41
Review record
- Examples use token tokens and contain no credential value.
- Positive and negative checks use non-mutating routes.
- Rotation and error classification are explicit.
- Bearer, loopback, browser, role, and tenant limits remain visible.
Review completed: 2026-08-27
Re-audited against the running product: 2026-09-13