Skip to main content
Auth for AI agents and for the humans behind them. theAuth gives every agent its own identity, checks permissions at call time and writes an audit row for every decision. It also ships human auth: email and password, magic link, passkeys, TOTP and more, plus 48 OAuth providers. Use either half alone, or both. Runs on Node, edge, Workers, Deno and Bun.
Building in Go? See the theAuth Go library docs and the theauth-go repository. Website: theauth.dev. Source: glincker/theauth. Not sure it fits? Read When not to use theAuth.

Pick your track

Add agent auth

Give agents an identity, scoped permissions, delegation and an audit trail. About five minutes.

Add human auth

Sign-up, sign-in, verification and reset with email and password, then add passkeys, OAuth and more. About five minutes.

Agent auth in one screen

Human auth in one screen

What’s in the box

Agent identity as a first-class entity, not an extension of a user.
Resource wildcards with rate limits, time windows, and IP allowlists.
Delegation chains with depth, expiry, and revocation that takes effect on the next call.
Audit log of every decision, with JSON and CSV export.
MCP OAuth 2.1 authorization server, PKCE, DCR and revocation-bound tokens.
Trust scoring per agent from audit history, plus budget policies.
Ten adapters for Node, edge, Workers, Deno, Bun.
Databases: SQLite and Postgres, plus Cloudflare D1. MySQL is not supported. See what is tested.
Web Crypto only in core, no Node-specific APIs.
Devices with their own credentials, enrollment, live revocation and signed offline policy bundles.
Robotics with ROS 2 permissions exported to SROS2 and DDS Security files, plus a gate node for hazardous commands.
Devices and robots use the same model as agents. A sensor, gateway or machine is a principal with its own credentials, permissions and audit rows, so one policy and one audit trail cover people, agents and hardware. Start with IoT devices or robotics and ROS 2.

How it fits with your stack

theAuth includes human auth, but you do not have to use it. If you already run Clerk, Auth.js, better-auth or your own login, keep it and pass the user ID as the agent’s owner. theAuth’s own methods (see Authentication) cover sign-in forms, password reset and social OAuth when you want one library for both.
Isometric diagram of your app, a framework adapter, the theAuth library and your own database, all sitting inside your own infrastructure.

theAuth runs inside your own app and infrastructure, with your own database.

Pick your framework

Next.js

App Router and Pages.

Hono

Workers, Deno, Bun.

Express

Classic Node handlers.

Fastify

Plugins and decorators.

NestJS

Guards and decorators.

Nuxt

Server routes.

SvelteKit

Hooks and endpoints.

Astro

Server islands.

The six primitives

Agent identity

Bearer tokens (ta_..., a prefix kept from before the rename), rotation, expiry. SHA-256 hashed at rest.

Permission engine

Resource wildcards, rate limits, time windows, IP allowlists, approval gates.

Delegation

Orchestrator delegates a subset to a sub-agent with depth and expiry. A revoked delegator stops lending permissions.

Audit trail

Every authorize() writes agent, user, resource, action, result, duration.

MCP OAuth 2.1

Spec-compliant AS with PKCE S256, RFC 9728, RFC 7591.

Trust scoring

Score per agent computed from audit history. Budget policies you check and record yourself.

Switching from another auth library

From better-auth

Concepts map, code diffs, data migration SQL.

From Clerk

Hooks, middleware, Clerk data export, rollout plan.
New releases land on GitHub every week or two. Watch the repo or follow @thegdsks for the highlights.

Core concepts

The mental model for agents, permissions, delegation, and audit.

MCP OAuth 2.1

Spec-compliant authorization server for Model Context Protocol tool servers.

Database setup

SQLite, Postgres, and Cloudflare D1 configuration. MySQL is not supported.

Standards alignment

IETF draft claims theAuth tracks and emits on agent JWTs.
Last modified on November 1, 2026