glincker /
theauth
Auth for AI agents and humans. First-class agent identity, MCP OAuth 2.1, delegation, audit. TypeScript, edge-native, MIT.
67/100 healthLoading repository data…
kaizen108 / repository
Auth for AI agents and humans. First-class agent identity, MCP OAuth 2.1, delegation, audit. TypeScript, edge-native, MIT.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
npm install @glinr/theauth
# or
pnpm add @glinr/theauth
# or
yarn add @glinr/theauth
import { createKavach } from "@glinr/theauth";
import { emailPassword, passkey } from "@glinr/theauth/auth";
import { createHonoAdapter } from "@glinr/theauth-hono";
const kavach = createKavach({
database: { provider: "postgres", url: process.env.DATABASE_URL },
plugins: [emailPassword(), passkey()],
});
const app = new Hono();
app.route("/api/auth", createHonoAdapter(kavach));
// Create an AI agent with scoped MCP permissions
const agent = await kavach.agent.create({
ownerId: "user-123",
name: "github-reader",
type: "autonomous",
permissions: [{ resource: "mcp:github:*", actions: ["read"] }],
});
const result = await kavach.authorize(agent.id, {
action: "read",
resource: "mcp:github:repos",
});
// { allowed: true, auditId: "aud_..." }
Most auth libraries stop at human sign-in. That leaves you stitching together separate systems when your AI agents need identity, scoped permissions, delegation, and audit trails. theauth handles both in one place.
| Capability | Auth0 | Clerk | Better-Auth | NextAuth | Lucia | theauth |
|---|---|---|---|---|---|---|
| License | Proprietary | Proprietary | MIT | ISC | MIT | MIT |
| Self-hosted | Partial | No | Yes | Yes | Yes | Yes |
| OAuth 2.1 server | Yes | Yes | Partial | No | No | Yes |
| MCP OAuth 2.1 | No | No | No | No | No | Yes |
| Passkeys / WebAuthn | Yes | Yes | Plugin | Plugin | No | Yes |
| Multi-tenant / orgs | Yes | Yes | Plugin | No | No | Yes |
| Audit log | Yes (paid) | Yes (paid) | No | No | No | Yes |
| AI agent identity | No | No | No | No | No | Yes |
| Edge runtimes | Partial | No | Yes | Partial | Yes | Yes |
kv_...)Built-in: SQLite, PostgreSQL, MySQL, Cloudflare D1
Plugin: Prisma (share an existing PrismaClient)
drizzle-orm, jose, zodnpm install @glinr/theauth @glinr/theauth-nextjs
// app/api/auth/[...theauth]/route.ts
import { createKavach } from "@glinr/theauth";
import { emailPassword } from "@glinr/theauth/auth";
import { createNextAuthHandler } from "@glinr/theauth-nextjs";
const kavach = createKavach({
database: { provider: "postgres", url: process.env.DATABASE_URL },
plugins: [emailPassword()],
});
const handler = createNextAuthHandler(kavach);
export { handler as GET, handler as POST };
// app/dashboard/page.tsx (Server Component)
import { getServerSession } from "@glinr/theauth-nextjs";
export default async function Dashboard() {
const session = await getServerSession();
if (!session) redirect("/sign-in");
return <h1>Hello, {session.user.email}</h1>;
}
See examples/nextjs-app for a full working example.
npm install @glinr/theauth @glinr/theauth-sveltekit
// src/hooks.server.ts
import { createKavach } from "@glinr/theauth";
import { emailPassword } from "@glinr/theauth/auth";
import { createSvelteKitHandler } from "@glinr/theauth-sveltekit";
const kavach = createKavach({
database: { provider: "sqlite", url: "kavach.db" },
plugins: [emailPassword()],
});
export const handle = createSvelteKitHandler(kavach);
// src/routes/+layout.server.ts
import { getSession } from "@glinr/theauth-sveltekit";
export async function load(event) {
const session = await getSession(event);
return { session };
}
npm install @glinr/theauth @glinr/theauth-nuxt
// server/plugins/theauth.ts
import { createKavach } from "@glinr/theauth";
import { emailPassword } from "@glinr/theauth/auth";
export const kavach = createKavach({
database: { provider: "postgres", url: process.env.DATABASE_URL },
plugins: [emailPassword()],
});
// nuxt.config.ts
export default defineNuxtConfig({
modules: ["@glinr/theauth-nuxt"],
});
npm install @glinr/theauth @glinr/theauth-hono
import { Hono } from "hono";
import { createKavach } from "@glinr/theauth";
import { emailPassword } from "@glinr/theauth/auth";
import { createHonoAdapter } from "@glinr/theauth-hono";
type Env = { DATABASE_URL: string };
const app = new Hono<{ Bindings: Env }>();
app.use("/api/auth/*", async (c, next) => {
const kavach = createKavach({
database: { provider: "postgres", url: c.env.DATABASE_URL },
plugins: [emailPassword()],
});
return createHonoAdapter(kavach)(c, next);
});
export default app;
See examples/hono-server and examples/cloudflare-workers.
Primary docs: docs.theauth.dev
| Section | Link | What you will find |
|---|---|---|
| Getting Started | docs.theauth.dev/docs/quickstart | Installation, first auth flow |
| Authentication | docs.theauth.dev/docs/auth | All auth methods and plugins |
| Agent Identity | docs.theauth.dev/docs/agents | Agent tokens, delegation, policies |
| Permissions | docs.theauth.dev/docs/permissions | RBAC, wildcard matching, ReBAC |
| MCP OAuth 2.1 | docs.theauth.dev/docs/mcp | MCP auth server setup |
| Framework Adapters | docs.theauth.dev/docs/adapters | Next.js, Hono, SvelteKit, etc. |
| API Reference | docs.theauth.dev/docs/api | Config, types, errors |
| Security | SECURITY.md | Threat model, disclosure policy |
| Package | Framework | Directory |
|---|---|---|
@glinr/theauth-nextjs | Next.js 15 (App Router) | packages/adapters/nextjs |
@glinr/theauth-nextjs-auth | Next.js (external auth backend) | packages/adapters/nextjs-auth |
@glinr/theauth-hono | Hono (Workers, Bun, Deno) | packages/adapters/hono |
@glinr/theauth-express | Express | packages/adapters/express |
@glinr/theauth-fastify | Fastify | packages/adapters/fastify |
@glinr/theauth-sveltekit | SvelteKit | packages/adapters/sveltekit |
@glinr/theauth-nuxt | Nuxt / Vue 3 | packages/adapters/nuxt |
@glinr/theauth-astro | Astro | [packages/adapters/astro](https://github.com/glincker/theauth/tree/ma |
Selected from shared topics, language and repository description—not editorial ratings.
glincker /
Auth for AI agents and humans. First-class agent identity, MCP OAuth 2.1, delegation, audit. TypeScript, edge-native, MIT.
67/100 healthshizhigu /
Production-grade auth rail for AI agents. Sits next to your existing human auth — never replaces it.
53/100 healthreaatech /
Identity-aware proxy for agent-to-service communication. OAuth2 token management, per-user credential isolation, scope enforcement, and audit logging. Agents act on behalf of users safely.