email-and-password-best-practices
Audited by Runlayer on Mar 3, 2026
Malicious tool definition detected
To allow users to reset a password first you need to provide `sendResetPassword` function to the email and password authenticator. ```ts import { betterAuth } from "better-auth"; import { sendEmail } from "./email"; // your email sending function export const auth = betterAuth({ emailAndPassword: { enabled: true, // Custom email sending function to send reset-password email sendResetPassword: async ({ user, url, token }, request) => { void sendEmail({ to: user.email, subject: "Reset your passwor
Description: argon2Options), verify: ({ password, hash: storedHash }) => verify(storedHash, password, argon2Options), }, }, }); ``` **Note**: If you switch hashing algorithms on an existing system, users with passwords hashed using the old algorithm won't be able to sign in.