Research-mind toolchains-platforms-auth-better-auth-better-auth-authentication
Better Auth Authentication
install
source · Clone the upstream repo
git clone https://github.com/MacPhobos/research-mind
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/MacPhobos/research-mind "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.claude/skills/toolchains-platforms-auth-better-auth-better-auth-authentication" ~/.claude/skills/macphobos-research-mind-toolchains-platforms-auth-better-auth-better-auth-authen && rm -rf "$T"
manifest:
.claude/skills/toolchains-platforms-auth-better-auth-better-auth-authentication/skill.mdsource content
Better Auth Authentication
Goals
- Enable email/password authentication and social providers.
- Implement sign-up, sign-in, sign-out, and verification flows.
- Handle redirects and errors consistently.
Quick start
- Enable
and configureemailAndPassword
.socialProviders - Create a client with
.createAuthClient - Use
,signUp.email
,signIn.email
, andsignIn.social
on the client.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, }, }, });
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();
Email verification
- Provide
to send the verification link.emailVerification.sendVerificationEmail - Use
to enforce verification before sign-in.emailAndPassword.requireEmailVerification
Social providers
- Configure providers in
with provider-specific credentials.socialProviders - Use
to start OAuth flows.signIn.social - Pass
,callbackURL
, anderrorCallbackURL
for redirects.newUserCallbackURL
Guardrails
- Call client methods from the client only.
- Keep secrets in server-only env variables.
- Use
to control persistent sessions on email/password sign-in.rememberMe
References
toolchains/platforms/auth/better-auth/better-auth-authentication/references/email-password.mdtoolchains/platforms/auth/better-auth/better-auth-authentication/references/providers.md