@agentonboard/sdk/next exports requireAgentAccount for Next.js App Router route handlers. It reads the Bearer token, verifies the RS256 signature locally against public JWKS keys, and resolves your App Account by verified email.
Copy-paste agent prompt
1. Install the SDK
- npm
- pnpm
- yarn
- bun
2. Guard your route handler
requireAgentAccount(request, options) accepts the standard Web API Request that App Router handlers receive (NextRequest satisfies it unchanged):
app/api/notes/route.ts
3. How errors are handled
When verification fails orresolveAccount returns null, session.ok is false and session.response is a ready-to-return Response (401 for token errors, 403 for ACCOUNT_REQUIRED, 500 for RESOLVER_ERROR or CONFIG_ERROR). See Errors & Status Codes and Framework Overview for onFailure customization.
4. Test with curl
Mint a 5-minute test token usingPOST /api/v1/token/exchange and call your Next.js route: