Integration verification with curl
Run these sixcurl checks against your local or staging server before publishing auth.md.
First, mint a 5-minute test token using POST /api/v1/token/exchange and your aon_live_... API Key:
1. Unknown email returns 403 ACCOUNT_REQUIRED
Before your email exists in your app’s database, call a protected endpoint:
403 with {"code": "ACCOUNT_REQUIRED", ...}.
If you receive 401, fix your status mapping so agents follow your 403 account-setup instructions instead of re-minting tokens.
2. Signup creates once and is idempotent on retry
If you implementedPOST /api/signup with createAgentAccount:
3. Tampered or wrong-Domain tokens return 401 without touching your DB
Corrupt the last character of the JWT signature and call both routes:
401 with {"code": "INVALID_SIGNATURE", ...} on both routes, with zero database queries executed.
Also test:
- No
Authorizationheader: Expect401 MALFORMED_TOKEN. - Wrong Domain: Mint a token with
{"audience": "other-domain.com"}and send it to your endpoint. Expect401 AUDIENCE_MISMATCH.
4. Expired tokens return 401 EXPIRED
Wait 5 minutes (plus 5 seconds for clock tolerance) and replay the original $TOKEN:
401 with {"code": "EXPIRED", ...}.
5. Database exceptions return 500 RESOLVER_ERROR without leaking secrets
Temporarily throw new Error("db-secret-test-string") inside resolveAccount and call your endpoint.
Expected: HTTP 500 with {"code": "RESOLVER_ERROR", ...}, and confirm "db-secret-test-string" never appears in the HTTP response body. Remove the test throw afterward.
6. auth.md matches your live responses
Fetch both discovery paths and verify:
- Both return
200 OKover HTTPS with no login redirect. - The hostname under
## Audiencematches theaudienceoption in your backend code. - The
403row in## When a request is rejectedmatches your live behavior (human connect URL orPOST /api/signup).
JWKS caching and production runtime
This section documents how@agentonboard/sdk (agentonboard/js-sdk) and agentonboard-sdk (agentonboard/agentonboard-python-sdk) fetch, cache, and rotate public JWKS keys in production.
How key resolution works per request
On each request, the SDK decodes the JWT header to readkid, resolves the matching RSA public key, verifies the signature and claims, and runs your resolveAccount callback.
The SDK uses your runtime’s global fetch (TypeScript) or httpx (Python) with zero filesystem or socket dependencies.
Caching and last-known-good fallback
Every fetched JWKS response is shape-checked before caching:- It must contain a
keysarray of valid RSA public keys (2048bits minimum) with uniquekidstrings. - Malformed JSON, non-RSA keys, or duplicate
kidvalues are treated as a failed fetch.
- Cache TTL:
1 hour(3,600,000 ms). - Unknown
kidrefetch cooldown:30 secondsin TypeScript (60 secondsin Python). Prevents a flood of forged tokens with fakekidvalues from triggering a flood of JWKS requests. - Maximum cached key sources:
8distinct issuer URLs per process (LRU-evicted).
Key rotation
When AgentOnboard rotates Signing Keys:- New tokens arrive with a new
kidin the header. - Your server sees the unknown
kidand refetches/.well-known/jwks.jsononce the 30-second cooldown has elapsed. - The new public key loads into memory and verification continues without dropping requests.
kid is removed from /.well-known/jwks.json, tokens signed by that retired key fail with UNKNOWN_KEY.
Operational edge cases
5-second latency spike when refreshing an expired cache during a JWKS outage
5-second latency spike when refreshing an expired cache during a JWKS outage
When the 1-hour cache expires and
/.well-known/jwks.json is unreachable or slow, the request triggering the refresh waits up to the 5-second fetch timeout before falling back to the last-known-good key set.If your serverless function or API gateway enforces a strict 3-second request timeout, that 5-second wait will time out the request. To avoid this:- Set route timeouts on agent-protected endpoints above 5 seconds, or
- Warm the verifier at process startup, or
- Pass a custom
fetchJwkscallback with a shorterAbortSignal.timeout(1500).
Why custom fetchJwks errors are sanitized
Why custom fetchJwks errors are sanitized
If your custom
fetchJwks callback throws, the SDK discards the raw error message and returns a generic KEY_SOURCE_UNAVAILABLE description so internal proxy URLs or credentials never leak into 401 bodies. Log errors inside fetchJwks before rethrowing.Fixed cryptographic constants
These parameters are pinned in the SDK:Production deployment checklist
-
audienceis hardcoded in your server source and matches## Audienceinauth.md. -
AON_ISSUER(orissuer) is set on any non-production environment verifying against a non-production issuer. - Route timeouts on protected endpoints allow at least 5 seconds for cold-start or hourly JWKS fetches.
-
ACCOUNT_REQUIREDreturns HTTP 403 (not 401). - Regular routes use
verifyAgentAccount(requireAgentAccount), andcreateAgentAccountis only used on an explicitPOST /api/signuproute if you opt into agent signup. - Application logs record
codeandjti, never raw JWTs orAuthorizationheaders. - Monitoring alerts on
KEY_SOURCE_UNAVAILABLEand spikes inUNKNOWN_KEY. - Both
https://<your-domain>/auth.mdandhttps://<your-domain>/.well-known/auth.mdreturn200 OKover HTTPS and match your live error codes.