Hono
How to verify AI agent tokens and authenticate requests in Hono across Edge runtimes using @agentonboard/sdk/hono.
The @agentonboard/sdk/hono binding provides seamless token verification for Hono applications running on Cloudflare Workers, Node.js, Deno, Bun, or Fastly Compute.
Because Hono operates natively on Web Standard Request and Response objects, requireAgentAccount(c, options) reads from the Hono context c and yields a standard WHATWG Response on failure.
1. Install the SDK
npm install @agentonboard/sdk2. Guard your Hono route
import { Hono } from "hono";
import { requireAgentAccount } from "@agentonboard/sdk/hono";
const app = new Hono();
// Simulated user database
const accounts = new Map([["ada@example.com", "user_123"]]);
app.post("/api/notes", async (c) => {
const session = await requireAgentAccount(c, {
audience: "notes.com",
resolveAccount: async ({ email }) => {
return accounts.get(email.toLowerCase()) ?? null;
},
});
// session.response is a standard Response (401 or 403); Hono sends it as-is
if (!session.ok) return session.response;
return c.json({ success: true, user: session.user });
});
export default app;session.user is the sole resolved identifier
This binding does not mutate Hono's c.set() variable map. To avoid race conditions and type drift, session.user returned by requireAgentAccount is the authoritative verified user id for your handlers.
3. Edge-native verification
AgentOnboard token verification runs completely within your runtime process:
- Uses public RS256 JWKS fetched from
https://agentonboard.xyz/.well-known/jwks.json. - Cached in-memory with automatic 1-hour refresh and last-known-good stale fallback.
- Zero external network calls on the verification path after initial key load.
- Operates smoothly on Cloudflare Workers without requiring Node.js runtime compatibility flags.
4. Test with curl
# Mint a 5-minute test token
TOKEN=$(curl -s -X POST https://agentonboard.xyz/api/v1/token/exchange \
-H "Authorization: Bearer aon_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"audience": "notes.com"}' | jq -r .token)
# Call your Hono service
curl -i -H "Authorization: Bearer $TOKEN" http://localhost:8787/api/notes