Standard password login
A login form submits a user's email and password to create an authenticated session.
Better Auth · Module
signIn.email authenticates a user through Better Auth’s client using a required email and password. Optional rememberMe and callbackURL fields control session persistence and the post-sign-in redirect.
The client method sends the user's email and password to the sign-in endpoint. It can also control whether the session survives browser closure and specify an optional post-login redirect; the call exposes data and error results for handling.
authClient.signIn.email({ email, password, rememberMe?, callbackURL? })| Name | Type | Description |
|---|---|---|
email | string | The user's email address. |
password | string | The user's password; at least 8 and at most 128 characters by default. |
rememberMe | boolean, optional | Whether to remember the session after the browser closes; defaults to true. |
callbackURL | string, optional | URL to redirect to after sign-in. |
An object containing data and error from the client sign-in operation.
import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient({
baseURL: "http://localhost:3000"
});
const { data, error } = await authClient.signIn.email({
email: "john.doe@example.com",
password: "password1234",
rememberMe: true,
callbackURL: "/dashboard"
});
if (error) console.error(error);
else console.log(data);Creates a Better Auth client and signs in with an email, password, session persistence preference, and optional redirect path.
A login form submits a user's email and password to create an authenticated session.
A login flow should return the user to a specific page after authentication.
A shared or temporary browser should not retain the session after closure.
Call the client method with the required email and password fields: authClient.signIn.email({ email, password }). The result provides data and error values for handling the outcome.
Follow-up: How can the post-login destination be controlled? Add the optional callbackURL field to the request, such as callbackURL: "/dashboard".
rememberMe controls session persistence after the browser closes. It defaults to true, while false signs the user out when the browser is closed.
Follow-up: What other optional request field is available? callbackURL specifies a URL to redirect to after sign-in.
The client method corresponds to the POST /sign-in/email endpoint. The request requires the user's email address and password, with optional rememberMe and callbackURL settings.
Follow-up: What should be checked when validating passwords? The documented default is at least 8 and at most 128 characters.
signUp.emailauth.api.signInEmailsignIn.emailOtpcallbackURLrememberMe