mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
|
History
|
||
|---|---|---|
| .. | ||
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| global.d.ts | ||
| lint-staged.config.js | ||
| oxlint.config.ts | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| turbo.json | ||
| vitest.config.ts | ||
@mastra/auth
Authentication utilities for protecting Mastra server endpoints and carrying trusted user context through agents and tools. The package exports MastraJwtAuth for JWT-based authentication; provider-specific integrations are published as separate @mastra/auth-* packages.
Installation
npm install @mastra/auth
Usage
Set JWT_AUTH_SECRET or pass a secret explicitly.
import { MastraJwtAuth } from '@mastra/auth';
import { Mastra } from '@mastra/core/mastra';
const auth = new MastraJwtAuth({ secret: process.env.JWT_AUTH_SECRET });
export const mastra = new Mastra({
server: { auth },
});
Documentation
Changelog
See the package changelog for version history and release notes.
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.