better-auth-authentication by bobmatnyc/claude-mpm-skills
npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill better-auth-authenticationemailAndPassword 并配置 socialProviders。createAuthClient 创建客户端。signUp.email、signIn.email、signIn.social 和 signOut。import { betterAuth } from "better-auth";
export const auth = betterAuth({
emailAndPassword: { enabled: true },
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
});
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient();
await authClient.signUp.email({
email,
password,
name,
});
await authClient.signIn.email({
email,
password,
callbackURL: "/dashboard",
});
await authClient.signIn.social({
provider: "github",
callbackURL: "/dashboard",
});
await authClient.signOut();
emailVerification.sendVerificationEmail 来发送验证链接。emailAndPassword.requireEmailVerification 强制要求登录前进行验证。socialProviders 中使用特定于提供商的凭据配置提供商。signIn.social 启动 OAuth 流程。callbackURL、errorCallbackURL 和 newUserCallbackURL 以进行重定向。rememberMe 控制电子邮件/密码登录时的持久会话。toolchains/platforms/auth/better-auth/better-auth-authentication/references/email-password.mdtoolchains/platforms/auth/better-auth/better-auth-authentication/references/providers.md每周安装量
75
代码仓库
GitHub 星标数
18
首次出现
2026年1月23日
安全审计
已安装于
opencode57
claude-code57
codex54
gemini-cli53
cursor51
github-copilot51
emailAndPassword and configure socialProviders.createAuthClient.signUp.email, signIn.email, signIn.social, and signOut on the client.import { betterAuth } from "better-auth";
export const auth = betterAuth({
emailAndPassword: { enabled: true },
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
});
import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient();
await authClient.signUp.email({
email,
password,
name,
});
await authClient.signIn.email({
email,
password,
callbackURL: "/dashboard",
});
await authClient.signIn.social({
provider: "github",
callbackURL: "/dashboard",
});
await authClient.signOut();
emailVerification.sendVerificationEmail to send the verification link.emailAndPassword.requireEmailVerification to enforce verification before sign-in.socialProviders with provider-specific credentials.signIn.social to start OAuth flows.callbackURL, errorCallbackURL, and newUserCallbackURL for redirects.rememberMe to control persistent sessions on email/password sign-in.toolchains/platforms/auth/better-auth/better-auth-authentication/references/email-password.mdtoolchains/platforms/auth/better-auth/better-auth-authentication/references/providers.mdWeekly Installs
75
Repository
GitHub Stars
18
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode57
claude-code57
codex54
gemini-cli53
cursor51
github-copilot51
Azure RBAC 权限管理工具:查找最小角色、创建自定义角色与自动化分配
131,500 周安装