# theAuth > Open-source auth for AI agents and humans. Agent identity, delegation, MCP OAuth 2.1, passkeys and SSO for TypeScript. Install the SDK with `pnpm add @glinr/theauth`. The full text of every page is in llms-full.txt. ## Docs - [theAuth](https://docs.theauth.dev/): Open-source auth for AI agents and humans. Agent identity, permissions, delegation, audit and MCP OAuth, plus human sign in and 48 OAuth providers, in one TypeScript SDK. - [Core concepts](https://docs.theauth.dev/concepts): The mental model you need before touching code. Agents, permissions, delegation, audit, trust, MCP. - [Quickstart](https://docs.theauth.dev/quickstart): Two five-minute tracks. Add agent auth (identity, permissions, audit) or human auth (email and password), or both. Scaffold a Next.js SaaS with one command. - [Dev mode: local agent auth server in one command](https://docs.theauth.dev/dev-mode): Start a local theAuth server with npx theauth dev. It seeds a demo user, two agents, a delegation and a policy check in under a minute. - [Works with](https://docs.theauth.dev/works-with): The frameworks, runtimes, identity providers, databases and client platforms theAuth works with. - [What's new](https://docs.theauth.dev/whats-new): What changed in the TypeScript SDK across the agent accountability, tool guard and revocation work, and what the pending release contains. - [Add to an existing app](https://docs.theauth.dev/add-to-existing-app): Drop theAuth into an app that already has human auth. Clerk, Auth.js, better-auth, or your own. - [Configuration](https://docs.theauth.dev/configuration): Reference for the `createTheAuth()` options in `TheAuthConfig`. Covers database providers, agent settings, session config, password reset, and which options createTheAuth actually reads. - [Database setup](https://docs.theauth.dev/database): Configure theAuth with SQLite, native SQLite, libSQL (Turso), Postgres, or Cloudflare D1. MySQL is not supported in this release. Covers connection setup, migration, WAL mode for native SQLite, and skipping auto-migrations. - [Bring your own Drizzle instance](https://docs.theauth.dev/bring-your-own-drizzle): Pass an existing Drizzle database to theAuth with database { drizzle, dialect } instead of a connection URL, and run the store contract suite against your own backend. - [Turso, Neon and Supabase](https://docs.theauth.dev/hosted-databases): Run theAuth on Turso (libSQL), Neon serverless Postgres or Supabase Postgres. A libsql provider, a Neon recipe over a WebSocket pool and the Supabase connection modes, with what was tested. - [Which storage should I pick](https://docs.theauth.dev/choose-storage): A decision guide for the two storage choices in theAuth, the main database and the secondary storage for short-lived state, by deployment shape (laptop, one server, many servers, serverless, Cloudflare Workers). - [Benchmarks](https://docs.theauth.dev/benchmarks): How the TheAuth benchmark harness works, what it measures, and how to run it. Results are published after the first CI run. - [Performance](https://docs.theauth.dev/performance): Measured costs of the hot paths (authorize, token and session verify, device bundles, approval hashing, admin lists), what was changed to lower them, and how to reproduce the numbers. - [Production security checklist](https://docs.theauth.dev/production-checklist): What to verify before real users and real agents hit your theAuth deployment. Secrets, cookies, proxies, rate limits, management routes, agents and MCP, webhooks, audit retention and backups. - [Troubleshooting](https://docs.theauth.dev/troubleshooting): Fixes for the problems people hit most often with theAuth, organized by symptom. Exact error codes, cookie and CORS pitfalls, OAuth redirects, clock skew, proxies, and serverless or edge runtimes. - [AI coding assistant setup with theAuth docs](https://docs.theauth.dev/ai-assistants): Set up Claude Code, Cursor and VS Code with theAuth docs, MCP config and rule files in one command: npx @glinr/theauth-cli init --agent. - [Session model](https://docs.theauth.dev/sessions): Cookie sessions, JWT tokens, ephemeral agent sessions, CSRF protection, session freshness, and lifecycle management. - [JWT sessions](https://docs.theauth.dev/jwt-sessions): Issue short-lived JWT access tokens and rotate refresh tokens with createJwtSessionModule. Stateless access token verification, refresh tokens tracked in the database. - [Session hardening](https://docs.theauth.dev/session-hardening): Opt-in (experimental) cookie cache, idle timeout, refresh token reuse grace, per-request base URLs, stateless sessions and federated logout. - [Cookie options](https://docs.theauth.dev/cookies): How theAuth sets session cookies, how to customize them, and the defaults for cross-subdomain and cross-origin setups. - [One-time tokens](https://docs.theauth.dev/one-time-tokens): Single-use tokens for email verification, password resets, invitations, and custom flows. - [Secondary storage](https://docs.theauth.dev/secondary-storage): Choose where TheAuth keeps rate limit counters, device codes and other short-lived state. Memory, your database, Cloudflare KV, Redis, or your own store. - [Authentication](https://docs.theauth.dev/auth/index): Human sign-in methods and OAuth providers for the humans who own and manage agents. - [Last login tracking](https://docs.theauth.dev/last-login): Record every successful authentication per user via createLastLoginModule. Retrieve last sign-in timestamp, method, and IP for security pages or your own checks. - [Email and password](https://docs.theauth.dev/auth/email-password): Email and password built into core (emailPassword config, /auth/email routes), plus username, passwordless (magic link, email OTP) and bring-your-own-adapter options. - [Username and password](https://docs.theauth.dev/auth/username): Authenticate users with a unique username and password via the `username` module. Covers length limits, pattern validation, and uniqueness enforcement at sign-up. - [Magic link](https://docs.theauth.dev/auth/magic-link): Issue single-use email links for passwordless sign-in with `magicLink()`. Configure the app URL, a send function, and token expiry. - [Email OTP](https://docs.theauth.dev/auth/email-otp): Authenticate users with a six-digit OTP sent to their email via `emailOtp`. Provide a `sendOtp` callback to deliver the code, then verify it to open a session. - [Phone number](https://docs.theauth.dev/auth/phone): Authenticate users with SMS one-time codes through the `phone` config key. Supply a `sendSms` callback, configure expiry and attempt limits, and forward requests to `theauth.phone.handleRequest`. - [Unified OTP](https://docs.theauth.dev/auth/otp): One service for email and SMS one-time codes with pluggable senders, resend cooldown, attempt lockout and constant-time checks, for sign-in, email verification, password reset and 2FA step-up. - [Passkey](https://docs.theauth.dev/auth/passkey): Authenticate users with WebAuthn passkeys via the `passkey()` plugin. Covers `rpId` and `origin` setup, registration and authentication ceremonies, and credential storage. - [Sign In With Ethereum](https://docs.theauth.dev/auth/siwe): Authenticate users via Ethereum wallet signature using the `siwe` plugin. Covers EIP-4361 nonce generation, secp256k1 recovery, and session creation. - [Device authorization](https://docs.theauth.dev/auth/device): OAuth 2.0 device flow for CLIs, smart TVs, and input-constrained devices. RFC 8628. - [Two-factor auth](https://docs.theauth.dev/auth/two-factor): Add TOTP second-factor authentication via the `twoFactor` plugin. QR code enrollment, 6-digit verification, and backup codes for any RFC 6238 authenticator. - [Captcha](https://docs.theauth.dev/auth/captcha): Protect sign-up and sign-in endpoints with Cloudflare Turnstile, hCaptcha, or reCAPTCHA. - [Anonymous auth](https://docs.theauth.dev/auth/anonymous): Issue guest sessions with `anonymousAuth`, then upgrade them to real accounts without changing the user ID or losing data accumulated during the anonymous period. - [Google One-tap](https://docs.theauth.dev/auth/one-tap): Authenticate users with Google One-tap via the `oneTap()` plugin. Verifies the Google ID token against JWKS and validates audience, issuer, expiry, and CSRF. - [OAuth proxy](https://docs.theauth.dev/auth/oauth-proxy): Server-side OAuth for mobile apps. Exchange authorization codes without exposing client secrets to the device. - [OAuth overview](https://docs.theauth.dev/auth/oauth): `oauth()` adds social sign-in via OAuth 2.0 with PKCE. Covers provider setup, the redirect URI, account linking, session creation, and adding custom providers. - [Social token API](https://docs.theauth.dev/auth/social-tokens): Read a refreshed provider access token with getAccessToken, list and unlink linked accounts, and encrypt stored provider tokens at rest. - [Google](https://docs.theauth.dev/auth/google): Wire Google OAuth 2.0 and OpenID Connect into theAuth. Covers Cloud Console setup, People API, consent screen configuration, and profile scope access. - [GitHub](https://docs.theauth.dev/auth/github): Wire GitHub OAuth 2.0 into theAuth with the `oauth()` plugin. Covers app registration, callback URL, client secret setup, and optional scope expansion. - [Apple](https://docs.theauth.dev/auth/apple): Add Sign in with Apple to your theAuth application. Covers credentials, client secret generation, iOS apps, and local development. - [Microsoft](https://docs.theauth.dev/auth/microsoft): Authenticate users via Microsoft Entra ID OAuth 2.0. Covers app registration, the `createMicrosoftProvider` factory, and restricting sign-in to a single tenant. - [Discord](https://docs.theauth.dev/auth/discord): Authenticate users via Discord OAuth 2.0. Register a redirect URI in the Developer Portal, pass client credentials to `createDiscordProvider`, and request scopes. - [Slack](https://docs.theauth.dev/auth/slack): Authenticate users with their Slack account via the `oauth` plugin. Uses Slack OpenID Connect with `openid`, `email`, and `profile` scopes. No Slack SDK required. - [LinkedIn](https://docs.theauth.dev/auth/linkedin): Authenticate users via LinkedIn OpenID Connect. Requires the Sign In with LinkedIn product, with `openid`, `profile`, and `email` scopes via the `oauth()` plugin. - [Facebook](https://docs.theauth.dev/auth/facebook): Authenticate users via Facebook OAuth 2.0 with `facebookProvider`. Covers Developer Portal setup, redirect URI, and the default email and public profile scopes. - [Spotify](https://docs.theauth.dev/auth/spotify): Authenticate users with Spotify via `createSpotifyProvider`. Configures OAuth 2.0 with `user-read-email` and `user-read-private` scopes and supports scope extension. - [Twitch](https://docs.theauth.dev/auth/twitch): Authenticate users with their Twitch account via the `oauth` plugin. Covers Developer Console setup and the `user:read:email` scope for profile access. - [Reddit](https://docs.theauth.dev/auth/reddit): Authenticate users via Reddit OAuth 2.0. Register a web app in Reddit App Preferences, copy the client ID and secret, and configure `createRedditProvider`. - [Twitter / X](https://docs.theauth.dev/auth/twitter): Authenticate users with Twitter/X via `createTwitterProvider`. Covers OAuth 2.0 PKCE, Developer Portal configuration, and `users.read` and `tweet.read` scopes. - [TikTok](https://docs.theauth.dev/auth/tiktok): Authenticate users with TikTok via the `oauth` plugin. Covers Login Kit setup, redirect URI configuration, and `user.info.basic` and `user.info.stats` scopes. - [Kakao](https://docs.theauth.dev/auth/kakao): Authenticate users via Kakao OAuth 2.0. Covers app creation, Kakao Login activation, redirect URI, and `profile_nickname` and `account_email` scopes. - [Naver](https://docs.theauth.dev/auth/naver): Authenticate users via Naver OAuth 2.0. Create a Naver Developer application, enable Naver Login, set the redirect URI, and configure `name` and `email` scopes. - [VK](https://docs.theauth.dev/auth/vk): Authenticate users with VK via the `oauth` plugin. Covers dev.vk.com app setup, redirect URI config, and scopes including `email`, `profile`, and `friends`. - [LINE](https://docs.theauth.dev/auth/line): Authenticate users via LINE OAuth 2.0 with `lineProvider()`. Create a LINE Login channel and configure `openid`, `profile`, and `email` scopes. - [WeChat](https://docs.theauth.dev/auth/wechat): Authenticate users with WeChat via the `oauth` plugin. Covers Open Platform registration, callback domain config, and `snsapi_login` and `snsapi_userinfo` scopes. - [Kick](https://docs.theauth.dev/auth/kick): Authenticate users via Kick OAuth 2.0. Register an app in the Kick developer dashboard, set a redirect URI, and configure `user:read` scope in the `oauth()` plugin. - [Cloudflare](https://docs.theauth.dev/auth/cloudflare): Authenticate users with Sign in with Cloudflare. Create an OAuth client in the Cloudflare dashboard, require the user-details.read scope, and add createCloudflareProvider to the oauth() plugin. - [Paybin](https://docs.theauth.dev/auth/paybin): Authenticate users with Paybin OpenID Connect. Register a client in the Paybin portal and add createPaybinProvider to the oauth() plugin. - [Roblox](https://docs.theauth.dev/auth/roblox): Authenticate users via Roblox OAuth 2.0. Create credentials in the Roblox Creator Dashboard and configure the `roblox` provider with `openid` or `profile` scopes. - [Notion](https://docs.theauth.dev/auth/notion): Authenticate users via Notion OAuth 2.0. Create a public integration, configure OAuth redirect URIs in Notion settings, and wire `createNotionProvider`. - [Figma](https://docs.theauth.dev/auth/figma): Authenticate users via Figma OAuth 2.0 with `createFigmaProvider`. Covers app registration, redirect URI setup, and the file read scope needed for design file access. - [Dropbox](https://docs.theauth.dev/auth/dropbox): Authenticate users via Dropbox OAuth 2.0 with `createDropboxProvider`. Covers App Console setup, redirect URI, and scopes for account info and file metadata access. - [Zoom](https://docs.theauth.dev/auth/zoom): Authenticate users with Zoom via `createZoomProvider`. Covers App Marketplace app creation, redirect URI setup, and the default `user:read` scope. - [Atlassian](https://docs.theauth.dev/auth/atlassian): Authenticate users via Atlassian OAuth 2.0 with `createAtlassianProvider`. Covers Jira and Confluence accounts, token refresh, and scope configuration for Atlassian APIs. - [Linear](https://docs.theauth.dev/auth/linear): Authenticate users via Linear OAuth 2.0. Register an OAuth application, configure the `linear` provider, and request `read` or `write` scopes as needed. - [GitLab](https://docs.theauth.dev/auth/gitlab): Authenticate users via GitLab OAuth 2.0, including self-hosted instances. Register an application and configure the `read_user` scope. - [Bitbucket](https://docs.theauth.dev/auth/bitbucket): Authenticate users via Bitbucket OAuth 2.0 with `bitbucketProvider`. Covers workspace OAuth consumer setup, callback URL, and the default account read scope. - [Salesforce](https://docs.theauth.dev/auth/salesforce): Authenticate users via Salesforce OAuth 2.0 with a Connected App. Configure redirect URIs in App Manager and wire the `salesforce` provider with `openid` scopes. - [Vercel](https://docs.theauth.dev/auth/vercel): Authenticate users with their Vercel account via the `oauth` plugin. Covers integration setup, redirect URI, and scopes for profile and project access. - [Railway](https://docs.theauth.dev/auth/railway): Authenticate users via Railway OAuth 2.0. Register an app in Railway settings, set the redirect URI, and configure `read:profile` and `read:email` scopes. - [Hugging Face](https://docs.theauth.dev/auth/huggingface): Authenticate users via Hugging Face OAuth 2.0. Configure `huggingfaceProvider` and request `read-repos`, `read-billing`, or other scopes. - [PayPal](https://docs.theauth.dev/auth/paypal): Authenticate users via PayPal OAuth 2.0. Enable Log In with PayPal in your developer app and configure the `paypal` provider with `profile` or `address` scopes. - [Coinbase](https://docs.theauth.dev/auth/coinbase): Authenticate users via Coinbase OAuth 2.0 with `coinbaseProvider`. Covers app registration, redirect URI setup, and wallet read scopes for account sign-in. - [Polar](https://docs.theauth.dev/auth/polar): Authenticate users via Polar OAuth 2.0. Register an OAuth app in Polar settings, configure the `polar` provider, and request `organizations:read` for org access. - [Auth0](https://docs.theauth.dev/auth/auth0): Authenticate users via Auth0 OIDC with `auth0Provider`. Pass your tenant domain and client credentials to attach Auth0-issued tokens to a theAuth session. - [Okta](https://docs.theauth.dev/auth/okta): Authenticate users via Okta OpenID Connect with `oktaProvider()`. Create an OIDC web app in the Okta Admin Console, copy your domain, and configure the provider. - [Yahoo](https://docs.theauth.dev/auth/yahoo): Authenticate users with Yahoo via `yahooProvider`. Covers Developer Console app creation, OpenID Connect API enablement, and email and profile scopes. - [More OAuth providers](https://docs.theauth.dev/auth/more-providers): Keycloak, Authentik, ZITADEL, OneLogin, Gitea, Patreon, Box, Yandex and WordPress.com presets built on the generic OIDC factory. - [Organizations](https://docs.theauth.dev/auth/organizations): `organization` plugin adds multi-tenant support: create orgs, invite members, assign roles, enforce per-org RBAC, and set caps on membership and orgs per user. - [SSO](https://docs.theauth.dev/auth/sso): Wire enterprise SSO with SAML 2.0 and OIDC providers such as Okta and Azure AD. Covers connection routing by email domain and how identities are derived from the IdP response. - [Admin](https://docs.theauth.dev/auth/admin): Manage users with `theauth.admin`: list accounts, apply permanent or time-limited bans, impersonate for support debugging, and delete user data on request. - [API keys](https://docs.theauth.dev/auth/api-keys): Create scoped API keys with `theauth.apiKeys.create()`, validate on every request, revoke by ID, and rotate to a new secret without changing the key's permission set. - [Stripe](https://docs.theauth.dev/auth/stripe): Wire Stripe checkout sessions, billing portals, and subscription webhooks via the `stripe` plugin or `createStripeModule`. No `stripe` npm package needed, calls Stripe's REST API directly. - [Polar payments](https://docs.theauth.dev/auth/polar-payment): Wire Polar subscription billing into theAuth with the `polar()` plugin or `createPolarModule`. Set an access token and webhook secret to sync checkout and subscription state. - [SCIM](https://docs.theauth.dev/auth/scim): Wire SCIM 2.0 directory sync for Okta, Azure AD, and Google Workspace. Automatically provisions and deprovisions users when your IdP roster changes. - [SCIM filter grammar reference](https://docs.theauth.dev/auth/scim-filter-reference): Full list of SCIM 2.0 filter operators, combinators, value-path selectors, and grammar edge cases supported by the theAuth SCIM server. - [SCIM PATCH reference](https://docs.theauth.dev/auth/scim-patch-reference): Operation types, path expressions with value filters, mutability rules, and DoS limits for the theAuth SCIM 2.0 PATCH endpoint. - [OIDC provider](https://docs.theauth.dev/auth/oidc-provider): `createOidcProviderModule()` turns theAuth into an OpenID Connect provider. Covers RS256 key setup, client registration, PKCE, and JWKS endpoint. - [OIDC provider logout](https://docs.theauth.dev/auth/oidc-logout): Add an end_session_endpoint and back-channel logout to theAuth as an OpenID Connect provider, and receive logout tokens as a relying party. - [Shared Signals (SSF, CAEP, RISC)](https://docs.theauth.dev/auth/shared-signals): Send and receive security events between identity systems with the OpenID Shared Signals Framework 1.0, CAEP and RISC. - [Agent identity](https://docs.theauth.dev/agents): Issue, rotate, revoke, and audit AgentIdentity tokens. Scoped permissions, parent/child delegation, and per-agent rate limits in one API. - [Ephemeral sessions](https://docs.theauth.dev/ephemeral-sessions): Short-lived, auto-expiring agent credentials for single-task computer-use agents. - [Delegation chains](https://docs.theauth.dev/delegation): Grant a subset of permissions from one agent to another, with depth limits and cascading revocation. - [IoT devices](https://docs.theauth.dev/iot-devices): Sensors, gateways and machines as principals with their own credentials, scoped permissions, enrollment, live revocation and signed offline policy bundles. - [SPIFFE workload identity](https://docs.theauth.dev/spiffe): Let a workload or robot that already holds a SPIFFE SVID act as a theAuth device or agent, with an RFC 8705 certificate bound token, no bootstrap secret needed. - [Device conformance kit](https://docs.theauth.dev/device-conformance-kit): Simulate a fleet of devices against the real handler with a deterministic clock, to test bundle verification, revocation snapshots and offline decisions at scale. - [Token vault](https://docs.theauth.dev/token-vault): Let agents call GitHub, Google, Slack and other APIs for a user without ever holding the long-lived credential. - [Permission engine](https://docs.theauth.dev/permissions): Authorize agent actions via resource pattern matching and per-permission constraints: rate limits, time windows, IP allowlists, and human approval gates. - [Policy engine](https://docs.theauth.dev/policy-engine): Unified authorization combining RBAC, ABAC constraints, and ReBAC graph queries behind one evaluate() call. - [Policy testing](https://docs.theauth.dev/policy-testing): Test who may do what with an in-memory TheAuth, a table of cases and vitest matchers, or run the same table in CI with theauth policy test. - [Relationship-based access control](https://docs.theauth.dev/rebac): Zanzibar-inspired ReBAC engine for hierarchical resources, relationship graphs, and permission inheritance. - [Policy templates](https://docs.theauth.dev/policies/templates): Nine copy-paste policy templates for agent authorization: tool allowlists, delegation scopes, org isolation, budget caps, business-hours gating, spend limits with approval, owner-only delegation, and ReBAC. - [AI agent identity and accountability](https://docs.theauth.dev/accountability): Give every AI agent its own identity, a named human owner, a policy check before each action, an audit record and an off switch. - [Agent RACI template](https://docs.theauth.dev/accountability-raci-template): A RACI table for AI agent actions, and how each Responsible, Accountable, Consulted and Informed cell is enforced at runtime in theAuth. - [Audit trail](https://docs.theauth.dev/audit): Immutable logging of every authorization decision, with filtering, export, and compliance references. - [Tamper-evident audit trail](https://docs.theauth.dev/audit-trail): Chain audit rows with SHA-256 or HMAC hashes, verify the chain, replay what an agent did, and export signed evidence. - [Input provenance](https://docs.theauth.dev/input-provenance): Record which messages, documents and tool outputs were in context for each AI agent call, so a prompt injection can be traced to the calls it influenced. - [Audit receipts and chain vectors](https://docs.theauth.dev/audit-receipts): The receipt format shared by the TypeScript and Go libraries, how to verify one with either, and the chain test vectors an outside verifier can use. Receipts interoperate, chains do not. - [Audit checkpoints and receipts](https://docs.theauth.dev/audit-checkpoints): Sign checkpoints of a tamper evident audit log and give counterparties receipts they can verify offline. - [Observability](https://docs.theauth.dev/observability): Decision events, OpenTelemetry spans and metrics, and a logger for the SDK's own diagnostics. - [Database hooks](https://docs.theauth.dev/database-hooks): Run code before and after a user, session or account is created or updated. Abort the write or replace fields. - [ID generation](https://docs.theauth.dev/id-generation): Choose how ids of users, sessions and OAuth accounts are made with advanced.database.generateId. Random UUID by default, UUID v7 or your own function. Database generated ids are refused. - [Policy shrink](https://docs.theauth.dev/policy-shrink): Apply least privilege to AI agent authorization by finding unused permissions and replaying decisions against a smaller policy. - [Privilege analyzer](https://docs.theauth.dev/analyzer): Scan agent permissions with `theauth.analyzer` to surface over-privileged identities, unused scopes, wildcard risks, and stale agents across your deployment. - [Trust scoring](https://docs.theauth.dev/trust): TrustScore is a 0 to 100 value from each agent audit log, mapping to five named levels that gate autonomy, approval requirements, and rate limit strictness. - [Anomaly detection](https://docs.theauth.dev/anomaly): What theAuth provides for spotting unusual agent behavior today (trust score anomaly count, the onViolation hook, audit queries) and what is not implemented. - [Approval flows](https://docs.theauth.dev/approval): CIBA-style async human-in-the-loop approval for actions that should not run unattended. - [Step-up authentication](https://docs.theauth.dev/step-up-auth): Ask for a fresher or stronger sign-in before a risky action (RFC 9470). Session context, approvals that need a fresh passkey or TOTP code, and the MCP OAuth server. - [Guard agent tools](https://docs.theauth.dev/agent-tools): Put the policy engine in front of the tools an AI agent calls, in any TypeScript agent framework. - [Taint-aware tool guard](https://docs.theauth.dev/taint-guard): Label where tool arguments came from so a prompt injection guard can hold risky AI agent tool calls for approval. - [Remote guards](https://docs.theauth.dev/guards): Plug an external guard such as HOL Guard into theAuth over HTTPS. Signed requests and responses, a strict verdict schema, fail closed, and a conformance check for vendors. - [Browser playground for taint guard and policy](https://docs.theauth.dev/playground): Try the taint guard, policy engine and signed audit receipts in a browser tab. The demo runs in WebAssembly SQLite with no server. - [Vercel AI SDK](https://docs.theauth.dev/vercel-ai-sdk): Guard Vercel AI SDK tools with theAuth, hold large calls for a human, and read the chained decision record. - [OpenAI Agents SDK](https://docs.theauth.dev/openai-agents-sdk): Guard OpenAI Agents SDK tools with theAuth, hold large calls for a human, and read the chained decision record. - [Guard LangGraph and Mastra agent tools](https://docs.theauth.dev/agent-frameworks): Wrap LangChain.js, LangGraph and Mastra tools in TypeScript with guardTool. Denied calls throw, and risky calls pause for human approval. - [Vercel AI SDK helper](https://docs.theauth.dev/integrations/vercel-ai-sdk): Wrap a Vercel AI SDK tool map with guardAiSdkTools from @glinr/theauth/integrations. Each call is authorized first and a refusal comes back as a structured denial. - [OpenAI Agents SDK helper](https://docs.theauth.dev/integrations/openai-agents-sdk): Guard OpenAI Agents SDK function tools with guardFunctionTool from @glinr/theauth/integrations. Authorize runs first and a refusal returns a structured denial. - [LangGraph and CrewAI](https://docs.theauth.dev/integrations/langgraph-crewai): Guard LangGraph, CrewAI and OpenAI Agents SDK tools from Python with theauth.integrations, or call POST /authorize/token directly. Includes a TypeScript guard for Node orchestrators. - [Permission simulator](https://docs.theauth.dev/simulator): Ask what an agent would be allowed to do, with a step by step trace and no side effects. - [Explain a decision](https://docs.theauth.dev/explain): Ask why authorize() would allow or deny a call, with the matched rule, delegation link, constraint checks and hook outcome, and no side effects. - [Rate limiting](https://docs.theauth.dev/rate-limiting): Apply per-IP limits on auth endpoints with the rateLimit plugin and per-agent call caps with the maxCallsPerHour constraint. - [CLI login (device flow)](https://docs.theauth.dev/cli-auth): Sign users into a CLI, TV app or MCP client with the OAuth device authorization grant (RFC 8628), with theauth login, logout and whoami. - [CLI tools](https://docs.theauth.dev/cli-tools): theauth init sets up a project, theauth doctor checks it and a running server, theauth secret generates keys, and theauth completions installs shell completion. - [Agent registration tokens](https://docs.theauth.dev/agent-registration-tokens): Let a headless agent or CLI create its own agent identity with a one-time, scoped, expiring token, without a human session on the agent side. - [Budget policies](https://docs.theauth.dev/budget-policies): Controlling LLM spend and call volume with per-agent, per-user, and per-tenant policies. - [Cost attribution](https://docs.theauth.dev/cost-attribution): Track LLM token spend, API call costs, and custom costs per agent, per tool, and per delegation chain. - [Stop prompt injection from making an AI agent send email](https://docs.theauth.dev/tutorials/prompt-injection-tool-guard): Label where tool arguments came from, then hold any email whose recipient was copied from a web page for human approval. Runnable TypeScript, no API key. - [Delegate a scoped token to an agent and revoke it](https://docs.theauth.dev/tutorials/agent-delegation-e2e): Walk through a user delegating a read-only token to an agent, an MCP server verifying it, a denied out-of-scope call, the audit trail, and revocation. Runnable TypeScript. - [Find and remove unused permissions from an AI agent](https://docs.theauth.dev/tutorials/remove-unused-agent-permissions): Replay recorded decisions to see which agent grants were never used, propose a smaller set, and preview what it would deny. Runnable TypeScript. - [Prove what your AI agent did without sharing your database](https://docs.theauth.dev/tutorials/verifiable-agent-receipts): Sign a checkpoint of your agent audit log, mint a receipt for one decision, and let a counterparty verify it offline with a public key. Runnable TypeScript. - [Revoke an agent's MCP access and watch it fail on the next request](https://docs.theauth.dev/tutorials/live-revocation): Delegate a read only MCP token to a sub-agent, call a tool, get denied, revoke the parent delegation, and see the same token rejected at once. Then compare cached and offline freshness. Runnable TypeScript. - [MCP OAuth 2.1](https://docs.theauth.dev/mcp): Configure theAuth as an OAuth 2.1 authorization server for the Model Context Protocol. Implements PKCE S256, RFC 9728, RFC 8414, RFC 8707, and RFC 7591. - [MCP server grants](https://docs.theauth.dev/mcp-grants): Enable client_credentials, RFC 8693 token exchange, jwt-bearer (ID-JAG) and private_key_jwt client authentication on the MCP authorization server. - [MCP token revocation](https://docs.theauth.dev/mcp-revocation): How revoking a delegation, an agent, a session or a token reaches MCP access tokens, the three freshness modes, the introspection endpoint, and where revocation stops short. - [MCP client compatibility](https://docs.theauth.dev/mcp-client-compat): The lenientClients options that relax strict MCP request checks for real-world clients, what each one gives up, and a recommended profile. - [Client ID metadata documents](https://docs.theauth.dev/mcp-client-id-metadata): How theAuth fetches an https client_id as a metadata document, how to configure it, what the consent screen must show, and what the fetcher does and does not protect against. - [OAuth 2.1 and MCP conformance test](https://docs.theauth.dev/conformance): Test any OAuth 2.1 or MCP server with one npx command. Get a pass, fail or skip report on agent-relevant checks, plus a shields.io badge. - [Admin MCP server for theAuth deployments](https://docs.theauth.dev/admin-mcp): Connect an MCP client to the theAuth admin server to inspect agents, delegations and audit logs. Writes like revoke_agent need human approval. - [DPoP and requireMcpAuth](https://docs.theauth.dev/dpop): Bind MCP access tokens to a client key with DPoP (RFC 9449) and protect resource handlers with requireMcpAuth. - [Sender constrained agent tokens](https://docs.theauth.dev/dpop-agent-tokens): Bind a ta_ agent token to a DPoP key (RFC 9449) or a client certificate (RFC 8705) so a leaked token is useless on its own. - [Reverse proxy gateway for AI agent auth](https://docs.theauth.dev/gateway): Run a reverse proxy in front of any HTTP API or MCP server to check agent tokens, permissions, rate limits and audit logs. - [MCP server gateway with OAuth 2.1 and RFC 9728](https://docs.theauth.dev/gateway-mcp): Put a gateway in front of an MCP server to validate OAuth 2.1 and DPoP tokens, serve RFC 9728 metadata, and enforce scopes and agent permissions. - [Robotics and ROS 2 authorization](https://docs.theauth.dev/robotics-ros2): Turn a robot's theAuth permissions into SROS2 and DDS Security files, and gate hazardous commands at runtime with approval and step up checks. - [Overview](https://docs.theauth.dev/adapters/index): Drop theAuth into Hono, Express, Next.js, Fastify, Nuxt, SvelteKit, Astro, NestJS, SolidStart, or TanStack with one adapter import. - [Route reference](https://docs.theauth.dev/adapters/routes): Every HTTP route the theAuth handler serves, with its auth level and status codes. The same table backs all framework adapters. - [Hono](https://docs.theauth.dev/adapters/hono): Mount theAuth auth routes on a Hono app with `theAuthHono(theauth)`. Web-standard Request/Response, runs on Workers, Bun, Deno, and Node. - [Elysia](https://docs.theauth.dev/adapters/elysia): Serve theAuth routes from an Elysia app with `createTheAuthHandler` and `app.mount`. No extra package, runs on Bun and any runtime Elysia supports. - [Nitro](https://docs.theauth.dev/adapters/nitro): Serve theAuth routes from a standalone Nitro server (v2 or v3) with `createTheAuthHandler`. No extra package. For Nuxt, use the Nuxt adapter. - [Effect](https://docs.theauth.dev/adapters/effect): Serve theAuth routes from an Effect HTTP server with `createTheAuthHandler` and `HttpEffect.fromWebHandler`. No extra package. Covers Effect 4 and Effect 3. - [Encore](https://docs.theauth.dev/adapters/encore): Serve theAuth routes from an Encore.ts service with a raw endpoint, and let `auth: true` endpoints accept agent tokens through a gateway auth handler. No extra package. - [Convex](https://docs.theauth.dev/adapters/convex): Use theAuth as the identity provider for a Convex backend. theAuth mints a short-lived ES256 JWT, Convex verifies it through a custom JWT provider, and `ctx.auth.getUserIdentity()` returns the signed-in user. - [Waku](https://docs.theauth.dev/adapters/waku): Serve theAuth routes from a Waku API route with `createTheAuthHandler`. No extra package, plus the bundler settings Waku needs for native packages. - [React Router](https://docs.theauth.dev/adapters/react-router): Serve theAuth routes from a React Router v7 resource route with `createTheAuthHandler`. Works on Node, Workers and any runtime that gives you a Request. - [Express](https://docs.theauth.dev/adapters/express): Mount theAuth auth routes on Express with `theAuthExpress(theauth)`. Returns a Router with agent identity, delegation, audit, and MCP OAuth 2.1 endpoints pre-mounted. - [Fastify](https://docs.theauth.dev/adapters/fastify): Register theAuth auth routes on Fastify with `theAuthFastify(theauth)`. Returns an async plugin for agent identity, delegation, audit, and MCP OAuth 2.1 endpoints. - [NestJS](https://docs.theauth.dev/adapters/nestjs): Wire theAuth into NestJS with `TheAuthModule.forRoot(options)`. Mounts agent identity, delegation, audit, and MCP OAuth routes as Express middleware in AppModule. - [Next.js](https://docs.theauth.dev/adapters/nextjs): Mount theAuth auth routes in Next.js with `theAuthNextjs(theauth)`. Drop into a catch-all App Router file for agent identity, delegation, and MCP OAuth 2.1 endpoints. - [Nuxt](https://docs.theauth.dev/adapters/nuxt): Mount theAuth auth routes in Nuxt with `theAuthNuxt(theauth)`. Returns an H3 EventHandler for a catch-all server route, covering agent identity and OAuth. - [SvelteKit](https://docs.theauth.dev/adapters/sveltekit): Mount theAuth auth routes in SvelteKit with `theAuthSvelteKit(theauth)`. Returns named server route handlers, fully edge-compatible with no conversion layer. - [SolidStart](https://docs.theauth.dev/adapters/solidstart): Mount theAuth auth routes in SolidStart with `theAuthSolidStart(theauth)`. Returns named route handlers using Web-standard Request, with no conversion layer needed. - [TanStack Start](https://docs.theauth.dev/adapters/tanstack): Mount theAuth auth routes in TanStack Start with `theAuthTanStack(theauth)`. Returns named handlers for a splat route using Web-standard Request. - [Astro](https://docs.theauth.dev/adapters/astro): Mount theAuth auth routes in an Astro app with `theAuthAstro(theauth)`. Returns named handlers for a catch-all API page, with full MCP OAuth 2.1 support. - [TypeScript client](https://docs.theauth.dev/client-sdk): Issue HTTP calls to theAuth from any runtime via `createTheAuthClient`. Covers agents, authorization, delegations, audit logs, and MCP registration. - [React hooks](https://docs.theauth.dev/react): Wire theAuth into React 18 apps via TheAuthProvider and hooks from @glinr/theauth-react. Supports Next.js App Router, Pages Router, Vite, and edge runtime backends. - [Vue](https://docs.theauth.dev/vue): Register theAuth auth in Vue 3 via createTheAuthPlugin. Provides useSession, useSignIn, useSignOut, and useUser composables for Vite, Nuxt, and Vue 3 setups. - [Svelte](https://docs.theauth.dev/svelte): Add theAuth auth to Svelte and SvelteKit apps with createTheAuthClient and createAgentStore. Session state is exposed as reactive Svelte stores. - [Solid](https://docs.theauth.dev/solid): Session accessors for Solid from `@glinr/theauth-client`, built on a framework-neutral session store with no solid-js dependency. - [Expo / React Native](https://docs.theauth.dev/expo): Wire theAuth auth into React Native and Expo apps with @glinr/theauth-expo. Stores tokens in AsyncStorage or SecureStore and authenticates via Authorization header. - [Lynx](https://docs.theauth.dev/lynx): Use theAuth from a Lynx app (ReactLynx). What Lynx provides, what the client session store needs from the runtime, and a storage recipe. Checked against the docs and a stripped runtime, not on a device. - [Go SDK](https://docs.theauth.dev/sdk-go): Call a theAuth TypeScript server from Go with theauth-go. Agents, delegation, audit, MCP servers, DPoP proofs and typed plugin endpoint calls with no third party dependencies. - [Python SDK](https://docs.theauth.dev/sdk-python): Use theAuth from Python with the theauth package. Sync and async httpx clients, MCP server registry, DPoP proofs and plugin route calls. - [Electron](https://docs.theauth.dev/electron): Add auth to Electron apps via `ElectronTheAuthProvider`. Covers OS keychain token storage, OAuth popup windows, IPC bridge, and session persistence. - [Browser extensions](https://docs.theauth.dev/browser-extension): Sign users into a Manifest V3 extension with OAuth 2.1 and PKCE, keep tokens out of content scripts, and optionally bind them with DPoP. - [UI components](https://docs.theauth.dev/ui-components): Drop-in React components for sign-in, sign-up, password reset, 2FA, and OAuth buttons from @glinr/theauth-ui. Tailwind-based, wired to TheAuthProvider automatically. - [UI headless](https://docs.theauth.dev/ui-headless): Unstyled, accessible React components for session lists, API and agent tokens, device approval and step-up re-authentication from @glinr/theauth-ui-headless. You bring the copy and the CSS. - [Publish theAuth components and MCP server](https://docs.theauth.dev/publishing): Install theAuth React components with the shadcn CLI, or list the theAuth MCP server in the official MCP Registry for discovery. - [Admin dashboard](https://docs.theauth.dev/dashboard): Embed `TheAuthDashboard` from `@glinr/theauth-dashboard` to manage agents, permissions, delegation chains, and audit logs. Runs standalone via `npx theauth dashboard`. - [Terraform provider](https://docs.theauth.dev/terraform): Manage theAuth agents, permissions, API keys, and organizations as Terraform resources. - [Prisma adapter](https://docs.theauth.dev/prisma): Read and write the main theAuth tables through an existing PrismaClient via @glinr/theauth-prisma. Supports Prisma transactions without requiring Drizzle as a second ORM client. - [Compliance](https://docs.theauth.dev/compliance): How TheAuth audit records and access controls map to EU AI Act, NIST, SOC 2, and ISO 42001 themes. Reports and control mapping only, not a certification. - [Verifiable credential exports](https://docs.theauth.dev/compliance/verifiable-credentials): Export audit records as signed W3C Verifiable Credentials that a third party can verify against your issuer key. - [GDPR data rights](https://docs.theauth.dev/gdpr): Data export, account deletion, and account anonymization endpoints that support GDPR data subject requests. - [Password breach checking](https://docs.theauth.dev/hibp): Reject or warn on passwords found in known data breaches using the HaveIBeenPwned Pwned Passwords API and theAuth's createHibpModule. - [Sign-in gate](https://docs.theauth.dev/sign-in-gate): One gate decides whether a verified sign-in may get a session. Forced password change, required second factor, trusted devices and a per-user session limit. - [Trusted devices](https://docs.theauth.dev/trusted-device): Skip two-factor auth on verified devices via createTrustedDeviceModule. Trust is stored as an HMAC-signed fingerprint with a configurable expiry duration. - [Multi-session](https://docs.theauth.dev/multi-session): Let users hold multiple active sessions and manage them from an account settings page. - [OWASP agentic AI top 10 mapped to theAuth](https://docs.theauth.dev/owasp-agentic-mapping): Map each OWASP Top 10 for Agentic Applications risk to the theAuth feature that addresses it, and the limit where that feature stops short. - [Security doctor](https://docs.theauth.dev/security-doctor): theauth doctor --security lints a config file for weak secrets, loose cookies, disabled lockout and open handlers, with stable finding ids and a CI exit code. - [Protect an MCP server with OAuth 2.1](https://docs.theauth.dev/use-cases/mcp-server-behind-oauth): Put an MCP server behind OAuth 2.1 with theAuth. Clients get a PKCE token, and the server checks audience (RFC 8707) and scopes on each request. - [GitHub Actions OIDC for CI agents (Go only)](https://docs.theauth.dev/use-cases/github-actions-oidc): Exchange a GitHub Actions OIDC token for a short-lived theAuth access token, with no stored client secret. Go only, as TypeScript has no helper. - [OAuth 2.1 server on SQLite in one Go binary](https://docs.theauth.dev/use-cases/sqlite-oauth-server): Run an OAuth 2.1 authorization server and MCP resource server from one Go binary and one SQLite file. Go only, not in the TypeScript package. - [Lifecycle hooks](https://docs.theauth.dev/hooks): Running custom logic before and after authorization, agent creation, and policy violations. - [Community integrations](https://docs.theauth.dev/community-integrations): Build a third-party integration that plugs into theAuth hooks, and get it listed in the community directory. - [requireScope](https://docs.theauth.dev/require-scope): Protect an endpoint for agents with one line in the Hono, Next.js, or Express adapter. - [Webhooks](https://docs.theauth.dev/webhooks): Push HMAC-signed HTTP POST payloads to external URLs for the events you emit. Configure endpoints with the `webhooks` option of createTheAuth. - [Event streaming](https://docs.theauth.dev/event-streaming): Stream events you emit (agent lifecycle, auth, budget, and others) to clients in real time via SSE using createEventStreamModule. Missed events replay from a timestamp cursor. - [Custom session fields](https://docs.theauth.dev/custom-session): Attach arbitrary data to sessions at creation time and read it back on validation. - [Additional fields](https://docs.theauth.dev/additional-fields): Extend the user and session schemas with typed custom fields, stored in existing metadata columns. - [Email templates](https://docs.theauth.dev/email-templates): Generate {subject, text, html} for auth emails via createEmailTemplates. Covers verification, password reset, magic link, OTP, invitation, and welcome emails. - [Email adapters](https://docs.theauth.dev/email-adapters): Resend, Amazon SES, Postmark, SendGrid and SMTP providers behind one interface, with a console provider for development. - [Internationalization](https://docs.theauth.dev/i18n): Translate auth error messages and email subjects into six built-in locales via createI18n. Supports a per-call locale and variable interpolation. - [W3C DID identity](https://docs.theauth.dev/did): Issue portable Ed25519-backed identities for agents using `did:key` or `did:web`. Agents sign payloads to prove identity across services without shared secrets. - [Verifiable credentials](https://docs.theauth.dev/verifiable-credentials): Issue and verify W3C Verifiable Credentials for agent identity, permissions, and delegation. - [Agent identity federation](https://docs.theauth.dev/federation): Issue and verify short-lived federation tokens so an AgentIdentity can authenticate at a remote theAuth instance without re-registration or shared databases. - [Multi-tenant isolation](https://docs.theauth.dev/multi-tenant): Tenant records and tenant-scoped agents on one theAuth instance. Tenant settings and suspension are stored but not enforced by the SDK. - [Standards alignment](https://docs.theauth.dev/standards): Which IETF drafts theAuth maps to, and how to emit the matching claims on issued tokens. - [Migration guides](https://docs.theauth.dev/migrate/index): Pick a migration guide for your current auth setup. Covers moving from better-auth, Clerk, Supabase Auth, WorkOS, the better-auth agent plugin, and Auth0 to theAuth. - [Upgrading to 2.0](https://docs.theauth.dev/upgrading-to-2): Breaking changes in theAuth 2.0 for integrations built on 1.x, with what changed and what to do. - [Pick a migration path](https://docs.theauth.dev/migrate/choose-a-path): Big bang, lazy password migration, or run both and move users as they log in. How to choose, and how to back out of each. - [Run both and migrate as users log in](https://docs.theauth.dev/migrate/run-both-and-migrate): The strangler fig approach. Keep your current auth running, create theAuth accounts as people sign in, and widen a percentage until you can retire the old system. - [Import users](https://docs.theauth.dev/migrate/import-users): Bring users and password hashes from Auth0, Keycloak, Clerk, Supabase, WorkOS, Better Auth, Auth.js or any CSV into theAuth, with a dry run first. - [Lazy password migration](https://docs.theauth.dev/migrate/lazy-passwords): Verify old password hashes on first login, then replace them with theAuth's own hash. Which algorithms work today and which need a library you provide. - [Coexist with your IdP](https://docs.theauth.dev/migrate/coexist-with-your-idp): Accept tokens from Auth0, Keycloak, Clerk or any OIDC provider next to theAuth, so you can add agent auth and MCP OAuth without touching your login. - [Migrate from better-auth](https://docs.theauth.dev/migrate/from-better-auth): Switch a better-auth app to theAuth. Maps betterAuth config, plugins, session types, and client hooks to theAuth equivalents with before and after diffs. - [Migrate from the better-auth agent plugin](https://docs.theauth.dev/migrate/from-better-auth-agent-plugin): Switch from @better-auth/agent-auth to theAuth AgentIdentity. Maps scopes to Permission objects and delegation chains, with cascading revocation support. - [Migrate from Auth.js (NextAuth)](https://docs.theauth.dev/migrate/from-next-auth): Move a Next.js app from Auth.js v5 (NextAuth) to theAuth. Config, route handler, middleware, session reads, OAuth providers, the database tables, and how to run both side by side while you cut over. - [Migrate from Clerk](https://docs.theauth.dev/migrate/from-clerk): Move a Clerk app to theAuth. Maps ClerkProvider, clerkMiddleware, useAuth, and Organizations to theAuth, with Next.js middleware sample and data export steps. - [Migrate from Supabase Auth](https://docs.theauth.dev/migrate/from-supabase): Export auth.users and auth.identities from Supabase, import them into theAuth with the supabase source, and keep bcrypt passwords working through lazy migration. - [Migrate from WorkOS](https://docs.theauth.dev/migrate/from-workos): Export AuthKit users from the WorkOS List users API, import them into theAuth with the workos source, and what to expect for passwords. - [Migrate from Auth0](https://docs.theauth.dev/migrate/from-auth0): Port an Auth0 tenant to theAuth. Maps tenants, M2M clients, Rules, and Actions to theAuth equivalents with side-by-side code diffs and SQL migration steps. - [Upgrade from Kavach names](https://docs.theauth.dev/migrate/from-kavach): Rename Kavach exports, env vars, imports and JSX components to TheAuth in one command with the theauth codemod rename CLI. - [REST API](https://docs.theauth.dev/api): Full HTTP endpoint reference for theAuth: agent CRUD, token authorization, delegation chains, audit log queries, and MCP OAuth 2.1 endpoints. - [OpenAPI spec](https://docs.theauth.dev/openapi): Generate an OpenAPI 3.1 document for the theAuth REST API to build clients in any language. - [Writing plugins](https://docs.theauth.dev/plugins): Add endpoints, migrations and lifecycle hooks to theAuth with the TheAuthPlugin interface. - [Redirect chains](https://docs.theauth.dev/redirect): Send users back to where they were going after sign-in, through onboarding and verification steps. - [Error codes](https://docs.theauth.dev/errors): TheAuthError carries a code, message, and optional details. All SDK functions return a Result union instead of throwing, with matching HTTP status codes on REST. - [Test utilities](https://docs.theauth.dev/test-utils): Test auth-dependent code without a database using @glinr/theauth-test-utils. Provides entity factories, in-memory mock auth server, and per-request user overrides. - [A2A protocol](https://docs.theauth.dev/a2a): Authenticate Google A2A protocol traffic between agents with theAuth bearer tokens, scoped permissions, and a shared audit trail. - [Compare theAuth](https://docs.theauth.dev/compare/index): Side-by-side breakdowns of theAuth against better-auth, Keycloak, Hanko, Casdoor, and paid platforms. Covers agent identity, MCP OAuth, RBAC, and deployment model. - [theAuth vs better-auth](https://docs.theauth.dev/compare/vs-ba): A sourced comparison of theAuth and better-auth for TypeScript applications, last checked 2026-10-18. - [theAuth vs Keycloak](https://docs.theauth.dev/compare/vs-keycloak): A sourced comparison of theAuth and Keycloak on devices, delegation and agent approvals, last checked 2026-10-18. - [theAuth vs Hanko](https://docs.theauth.dev/compare/vs-hanko): theAuth versus Hanko across passkey support, OAuth providers, agent identity, MCP OAuth, RBAC, and licensing. Includes a clear decision framework for each tool. - [theAuth vs Casdoor](https://docs.theauth.dev/compare/vs-casdoor): theAuth as an in-process TypeScript library versus Casdoor as a standalone Go IAM service. Compares MCP OAuth 2.1, agent identity, LDAP, RBAC, and deployment model. - [theAuth vs paid auth platforms](https://docs.theauth.dev/compare/vs-paid): theAuth versus Clerk and Auth0: open-source self-hosted against managed platforms. Covers cost, data residency, agent identity gaps, and when each fits.