一键导入
authentication-logic
Guide to using Better Auth for client and server-side authentication.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide to using Better Auth for client and server-side authentication.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Documentation for the FastAPI backend, endpoints, and dependency injection.
Overview of the project's tech stack, directory structure, and architectural patterns.
Validates and analyzes Docusaurus MDX chapters for structure, pedagogical quality, and component usage.
Details of the RAG Chatbot, including UI and backend logic.
Interaction with NeonDB Postgres using Drizzle ORM.
Knowledge of the Vercel deployment pipeline, hybrid build scripts, and environment configuration.
| name | Authentication Logic |
| description | Guide to using Better Auth for client and server-side authentication. |
We use Better Auth (better-auth) for identifying users.
lib/auth-client.ts exports authClient.lib/auth.ts exports auth.Use authClient for signing in, signing out, and checking session state in Client Components.
import { authClient } from "@/lib/auth-client";
// Sign In
await authClient.signIn.email({
email,
password,
});
// Social Sign In
await authClient.signIn.social({
provider: "google",
callbackURL: "/onboarding",
});
// Sign Out
await authClient.signOut();
Use auth.api.getSession for protecting API routes or Server Actions.
import { auth } from "@/lib/auth";
import { headers } from "next/headers";
const session = await auth.api.getSession({
headers: await headers()
});
if (!session) {
return new Response("Unauthorized", { status: 401 });
}
textbook/src/components/AuthBar/index.tsx./api/auth/session (Next.js API route proxying Better Auth).