@glinr/theauth-nuxt
@glinr/theauth-nuxt
npm · Source · Docs · All packages
Nuxt adapter for theAuth.
Part of theAuth, open-source auth for AI agents and humans. Docs: docs.theauth.dev.
Install
pnpm add @glinr/theauth @glinr/theauth-nuxt
Usage
Create server/api/theauth/[...].ts:
import { createTheAuth } from '@glinr/theauth';
import { theAuthNuxt } from '@glinr/theauth-nuxt';
const theauth = createTheAuth({
database: { provider: 'sqlite', url: 'theauth.db' },
});
export default theAuthNuxt(theauth, { authenticate });
This handles the full theAuth REST API under /api/theauth: agent CRUD, authorization, delegations, audit logs, and dashboard stats.
With MCP OAuth 2.1
import { createMcpModule } from '@glinr/theauth/mcp';
import { theAuthNuxt } from '@glinr/theauth-nuxt';
const mcp = createMcpModule({
issuer: 'https://your-app.com',
// ...
});
export default theAuthNuxt(theauth, { mcp, authenticate });
When mcp is provided, the OAuth 2.1 endpoints are enabled:
GET /.well-known/oauth-authorization-serverGET /.well-known/oauth-protected-resourcePOST /mcp/registerGET /mcp/authorizePOST /mcp/token
Management routes and client IP
With the default session guard, a signed-in user only acts on their own agents, delegations and audit rows. A custom authenticate resolver is a trust decision and sees everything.
The adapter does not read forwarded headers for the client IP. Behind a proxy, set trustedProxy with trustedProxyCount or trustedHeader, or ipAllowlist constraints cannot match.
export default theAuthNuxt(theauth, { authenticate, trustedProxy: { trustedProxyCount: 1 } });
On Cloudflare use trustedHeader: "cf-connecting-ip". Only trust a header your edge overwrites.
API surface
theAuthNuxt(theauth, options?) returns an H3 EventHandler for use as a Nuxt server route.
| Option | Type | Description |
|---|---|---|
mcp |
McpAuthModule |
Enables MCP OAuth 2.1 endpoints |
basePath |
string |
URL prefix before the catch-all segment. Defaults to /api/theauth |
For full docs on agent identity, permissions, delegation, and audit, see the main @glinr/theauth package.
Links
License
MIT
Learn more
Related Packages
Nuxt adapter for KavachOS - exposes agent auth as HTTP REST endpoints via H3
MCP server from your Nuxt dev server helping models to understand your Nuxt app...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 5.1.0 | ^3.0 | MIT | |
| 5.0.1 | ^3.0 | MIT | |
| 5.0.0 | ^3.0 | MIT | |
| 4.0.0 | ^3.0 | MIT | |
| 3.0.3 | ^3.0 | MIT | |
| 3.0.2 | ^3.0 | MIT |