360 Secure SkillHub
360 安全技能中心

nuxt-better-auth

该 Skill 是 Nuxt 应用的认证集成指南,围绕 @nuxtjs/better-auth 说明安装与环境变量、客户端和服务端会话、路由保护、插件注册、数据库/类型配置及连接外部 Better Auth 服务,并提醒服务端校验、会话刷新和类型检查。

onmax
热度 18.44
最近更新 2026-10-19 02:47:27
分类:开发依赖:纯提示词应用场景:代码生成 / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add onmax/nuxt-skills/nuxt-better-auth
Metadata
name
nuxt-better-auth
description
Guides authentication in Nuxt apps using @nuxtjs/better-auth. Use when installing or configuring the module, using its client or server APIs, protecting routes, refreshing sessions, or integrating Better Auth plugins.
license
MIT

Nuxt Better Auth

Use the smallest reference that matches the task.

Pick a reference

Task Read
Install the module, configure environment variables, or create config files references/installation.md
Read client session state, build auth forms, call plugins, or fetch auth-bound data references/client-auth.md
Read or enforce sessions in server handlers, create sessions, or refresh cached session data references/server-auth.md
Protect pages or API routes and configure redirects references/route-protection.md
Register Better Auth plugins and their client companions references/plugins.md
Configure NuxtHub, generated schema, or secondary storage references/database.md
Connect a Nuxt frontend to an external Better Auth server references/client-only.md
Use inferred auth types or add project fields references/types.md

Rules that apply across tasks

  • Confirm the consumer's installed package version supports each API you use. The published skill may be newer than the consumer's lockfile.
  • Enforce protected API reads and mutations server-side with requireUserSession(event). Route rules and page meta also control navigation.
  • Navigate only to validated local redirect paths.
  • In clientOnly mode, do not use local server helpers or expect SSR session hydration.
  • After server-side changes to session payload fields, call refreshSessionCookieCache(event). Wrap custom client auth endpoints that create or change the current session with runWithSessionRefresh().

Before finishing an implementation, run the consumer's typecheck and the narrowest relevant auth test.

Resources