MastraAuthClerk 类
🌐 MastraAuthClerk Class
MastraAuthClerk 类为 Mastra 应用提供使用 Clerk 的身份验证。它使用 Clerk 签发的 JWT 令牌验证传入请求,并通过 auth 选项与 Mastra 服务器集成。
🌐 The MastraAuthClerk class provides authentication for Mastra applications using Clerk. It verifies incoming requests with Clerk-issued JWT tokens and integrates with the Mastra server using the auth option.
使用示例Direct link to 使用示例
🌐 Usage example
src/mastra/index.ts
import { Mastra } from "@mastra/core";
import { MastraAuthClerk } from "@mastra/auth-clerk";
export const mastra = new Mastra({
server: {
auth: new MastraAuthClerk({
jwksUri: process.env.CLERK_JWKS_URI,
publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
secretKey: process.env.CLERK_SECRET_KEY,
}),
},
});
构造函数参数Direct link to 构造函数参数
🌐 Constructor parameters
publishableKey?:
string
= process.env.CLERK_PUBLISHABLE_KEY
Your Clerk publishable key. Can be found in your Clerk Dashboard under API Keys.
secretKey?:
string
= process.env.CLERK_SECRET_KEY
Your Clerk secret key. Used for server-side authentication and token verification.
jwksUri?:
string
= process.env.CLERK_JWKS_URI
The JWKS URI from your Clerk application. Used to verify JWT signatures.
name?:
string
Custom name for the auth provider instance.
相关Direct link to 相关
🌐 Related