email-and-password-best-practices

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

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/Ishaq74/atomic --skill email-and-password-best-practices-ishaq74
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: email-and-password-best-practices
Source: https://github.com/Ishaq74/atomic/tree/main/.github/skills/emailAndPassword
Command: npx skills add https://github.com/Ishaq74/atomic --skill email-and-password-best-practices-ishaq74

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Setting up secure email/password authentication with Better Auth involves many moving parts—verification emails, reset flows, token expiry, session revocation, and hashing algorithms—and misconfiguring any of them creates security gaps or broken user flows. ## Core Features & Use Cases - Email Verification Setup: Configure sendVerificationEmail and optionally block sign-in until verification with requireEmailVerification. - Password Reset Flows: Implement sendResetPassword, control token expiry, revoke sessions on reset, and handle background tasks on serverless platforms. - Password Policies & Hashing: Set min/max password lengths and swap the default scrypt hashing for Argon2id via custom hash and verify functions. - Use Case: You are adding credential-based sign-up and login to an Astro or Node.js app with Better Auth and need verification emails, a secure reset flow, and Argon2id hashing configured correctly the first time. ## 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 a function that sends the verification URL to the user. To block sign-in until verification, also enable `emailAndPassword.requireEmailVerification`.

How to implement a password reset flow in Better Auth?

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

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

Better Auth uses scrypt by default, but you can supply custom `hash` and `verify` functions under `emailAndPassword.password` to use Argon2id via @node-rs/argon2. 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 lifetime with `resetPasswordTokenExpiresIn`, specified in seconds.

Why is my Better Auth reset email not sending on serverless?

On serverless platforms, background email sending may be terminated before completion. Configure `advanced.backgroundTasks.handler` to wrap the promise with your platform's mechanism, such as `waitUntil`, so the task finishes.