ZH
测试版翻译

@yohangel / auth-nest

1.0.0 ▾
MIT
GitHub

适用于 NestJS 的 Better Auth:带 @AllowAnonymous、@OptionalAuth 和 @Session 的全局守卫

代码3 个文件上下文约 369 个 token扫描通过

应用 .genpmignore 后将被注入的确切目录树。固定于

src/lib/auth-nest/index.ts只读 · 7145b9d
// @yohangel/auth-nest — Better Auth en NestJS (plataforma Express) vía @thallesp/nestjs-better-auth.
// Registra un AuthGuard GLOBAL: toda ruta exige sesión salvo @AllowAnonymous() u @OptionalAuth().
// main.ts: `NestFactory.create(AppModule, { bodyParser: false })` (Better Auth lee el cuerpo; el módulo vuelve a
// activar json/urlencoded para el resto de rutas).
import { AuthModule } from '@thallesp/nestjs-better-auth';
import { type CreateAuthOptions, createAuth } from '../auth/index.js';

/** `imports: [authModule()]` en tu AppModule. */
export function authModule(opts: CreateAuthOptions = {}) {
  return AuthModule.forRoot({ auth: createAuth(opts) });
}

export {
  AllowAnonymous,
  AuthGuard,
  OptionalAuth,
  Session,
  type UserSession,
} from '@thallesp/nestjs-better-auth';

举报 @yohangel/auth-nest

使用 GitHub 登录后才能举报包。