Self-hosted auth for people and AI agents. Each agent gets its own token, scoped permissions, delegation and an audit trail, in your app and your database.
npm install @glinr/theauth@1.2.0Quickstart · Security · Status · Compare · Docs
Needs Node 20 or newer. Save as quickstart.mjs and run node quickstart.mjs. It uses an in-memory SQLite database.
import { createTheAuth, users } from "@glinr/theauth";
const auth = await createTheAuth({
database: { provider: "sqlite", url: ":memory:" },
agents: { enabled: true },
});
// Every agent has a human owner.
const now = new Date();
await auth.db.insert(users).values({
id: "user-1", email: "owner@example.com", name: "Owner", createdAt: now, updatedAt: now,
});
const agent = await auth.agent.create({
ownerId: "user-1",
name: "github-reader",
type: "autonomous",
permissions: [{ resource: "mcp:github:*", actions: ["read"] }],
});
const read = await auth.authorize(agent.id, { action: "read", resource: "mcp:github:repos" });
const write = await auth.authorize(agent.id, { action: "write", resource: "mcp:github:repos" });
console.log(read.allowed, write.allowed); // true false
console.log(write.reason); // why it was deniedagent.token is returned when the agent is created. Next: the documentation and examples. Both follow this repository, which is ahead of npm (see Status).
| Your problem | What theAuth does |
|---|---|
| Agents share one API key with full access | Gives each agent its own token and a list of allowed actions and resources |
| A sub-agent needs part of its parent's access | Delegates a subset with an expiry; revoking the parent cuts it off |
| You cannot tell what an agent did | Writes an audit row for each authorization, with an optional hash chain |
| Some actions need a person to say yes | A permission can require approval before it passes |
| MCP clients expect OAuth 2.1 | Ships MCP authorization server functions in @glinr/theauth/mcp |
Everything in this table is exported by @glinr/theauth 1.2.0 on npm.
Checked against the npm registry on 2026-12-03. Details and the full package list: what npm serves.
| Area | State |
|---|---|
@glinr/theauth |
1.2.0 on npm. This repository is at 2.0.0, which is not published |
| Only in the repository | Built-in email and password, auth.user, the @glinr/theauth/http handler and the other 2.0.0 changes |
| Framework adapters, email and gateway packages | Published, but they accept core below 1.0. Installing an adapter or the email package together with core makes npm pick core 0.8.0 |
@glinr/theauth-cli |
Version 1.2.0 on npm does not install |
@glinr/theauth-client, @glinr/theauth-mcp |
1.1.1 on npm, install cleanly |
| SAML | Experimental, no independent audit |
| Databases | SQLite is tested in CI. Postgres is run by hand, D1 is untested, MySQL is not supported (details) |
Version rules are in STABILITY.md.
| theAuth 1.2.0 | Better Auth | Auth.js | Clerk | Auth0 | |
|---|---|---|---|---|---|
| Runs as | Library | Library or self-hosted server | Library | Hosted service | Hosted service |
| Passkeys | Yes | Plugin | Experimental | Paid in production | Yes |
| SAML | Experimental | Plugin | Through BoxyHQ | Paid in production | Yes |
| OAuth server for MCP | Yes | Plugin | Yes | Yes | |
| Agent identity | Yes | Plugin, not yet stable | Agents act as the user | Early access | |
| Hosted dashboard | Paid add-on | Yes | Yes |
A blank cell means we did not verify it. Sources, retrieval dates and when each of the others is the better pick: docs/COMPARISON.md. Also read when not to use theAuth.
| Check it yourself | Where |
|---|---|
| Private vulnerability reporting, or support@glinr.com | Security policy |
| Tests, CodeQL, OSV scan, dependency review, Scorecard | Workflows |
610 test files under packages/ (counted 2026-12-03) |
packages |
npm provenance attestation on @glinr/theauth 1.2.0 |
npm |
| MIT license, governance and maintainers | License, Governance, Maintainers |
Know before you adopt: the first commit is dated 2026-03-21 and there has been no third party security audit.
- Star glincker/theauth if it is useful to you.
- Ask or report in Discussions, issues or the GLINR Discord.
- Contribute with CONTRIBUTING and the code of conduct.
Formerly kavachOS: see the rename map. The Go library is glincker/theauth-go.
Built by GLINCKER, a GLINR STUDIOS company. More from the team:
|
Open source from the team behind theAuth |
Levelrail Self-hosted deployment platform. Git push, HTTPS, logs, rollback. |
theSVG Open SVG brand library with logos, icons and flags. |