email-and-password-best-practices

Configure email verification, password reset flows, and hashing policies for Better Auth credential authentication.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aashahin/ai-skills --skill email-and-password-best-practices-aashahin
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: email-and-password-best-practices
Source: https://github.com/aashahin/ai-skills/tree/main/email-and-password-best-practices
Command: npx skills add https://github.com/aashahin/ai-skills --skill email-and-password-best-practices-aashahin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires better-auth, @node-rs/argon2.

What problem does it solve? Setting up secure email and password authentication involves many moving parts: verification emails, reset flows, token expiry, session revocation, and hashing algorithms. This Skill consolidates the correct Better Auth configuration patterns so you avoid common security mistakes like timing attacks, weak password policies, or broken callback URLs. ## Core Features & Use Cases - Email Verification Setup: Configure sendVerificationEmail and optionally require verification before sign-in with requireEmailVerification. - Password Reset Flows: Implement sendResetPassword, control token expiry with resetPasswordTokenExpiresIn, and revoke sessions on reset with revokeSessionsOnPasswordReset. - Custom Password Hashing: Replace the default scrypt hashing with Argon2id by providing custom hash and verify functions. - Use Case: You are adding credential-based sign-up and sign-in to a Next.js app with Better Auth. Use this Skill to wire up verification emails, a secure reset flow with 30-minute token expiry, and Argon2id hashing, then run the CLI migration. ## Quick Start Ask the AI to configure Better Auth email and password authentication with email verification, a password reset flow, and Argon2id hashing in your auth config file.

Frequently Asked Questions about email-and-password-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up email verification with Better Auth?▼

Configure emailVerification.sendVerificationEmail in your Better Auth config with an async function that sends the verification URL to the user's email. To block sign-in until verification, also set emailAndPassword.requireEmailVerification to true.

How do I implement a password reset flow in Better Auth?▼

Provide a sendResetPassword function in the emailAndPassword config that emails the reset URL to the user. Then call authClient.requestPasswordReset with the user's email and a redirectTo URL to trigger the flow.

Can I use Argon2 instead of scrypt for password hashing in Better Auth?▼

Yes, Better Auth defaults to scrypt but accepts custom password.hash and password.verify functions. You can plug in @node-rs/argon2 with Argon2id parameters, though existing users hashed with the old algorithm will need a migration strategy.

How long do Better Auth password reset tokens last?▼

Reset tokens expire after 1 hour by default and are single-use, deleted immediately after a successful reset. You can change the expiry with the resetPasswordTokenExpiresIn option, specified in seconds.

Why is my Better Auth callback URL failing after sign-up?▼

Callback URLs must be absolute URLs including the origin, such as https://example.com/callback. Relative URLs force Better Auth to infer the origin, which breaks when your frontend and backend run on different domains.

Does Better Auth invalidate sessions after a password reset?▼

Only if you enable revokeSessionsOnPasswordReset in the emailAndPassword config. When set to true, all existing sessions for the user are invalidated immediately after a successful password reset.