requireScope(theauth, { action, resource }) guards a route so only agents holding that permission reach your handler. It reads Authorization: Bearer ta_..., calls authorizeByToken, and either answers the request itself or continues with the agent identity attached.
Behavior
Errors use the same
{ "error": { "code", "message" } } shape as the rest of the adapters. Every check is recorded in the audit trail like any other authorization.
Hono
Next.js
The guard wraps a route handler. The handler receives the agent as its second argument and the route context as its third.Express
Options
requireScope is separate from theAuthHono, theAuthNextjs, and theAuthExpress. It does not need the management routes or an authenticate resolver.