Standard email registration
A new user submits an email, password, and display name through a registration form.
Better Auth · Const
signUp exposes the client’s email-registration method as authClient.signUp.email. It creates a user from the supplied name, email, password, and optional image, then signs the user in automatically by default.
The client’s signUp.email method sends the user’s registration details to Better Auth’s email sign-up endpoint. A successful registration signs the user in automatically unless autoSignIn is set to false; the call returns either data or an error.
const { data, error } = await authClient.signUp.email({ email, password, name, image, autoSignIn });| Name | Type | Description |
|---|---|---|
email | string | The user's email address. |
password | string | The user's password; at least 8 characters and at most 128 by default. |
name | string | The user's display name. |
image | string | Optional URL for the user's image. |
autoSignIn | boolean | Optional flag controlling automatic sign-in after successful registration. |
An object containing data and error; successful registration returns sign-up data, while failures are represented by error.
authClient.signUp.email to create an account through the client API.autoSignIn: false when registration should not establish a signed-in session.import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient();
const { data, error } = await authClient.signUp.email({
name: "Ada Lovelace",
email: "ada@example.com",
password: "correct-horse-battery-staple",
});
if (error) console.error(error);
else console.log(data);Creates a client and submits the required name, email, and password to register a user.
A new user submits an email, password, and display name through a registration form.
An application needs to collect a profile picture during account creation.
A flow requires a separate login step after account creation.
Use the client method authClient.signUp.email with the user’s name, email, and password. It corresponds to the POST /sign-up/email endpoint.
Follow-up: What happens after success? The user is automatically signed in by default, but setting autoSignIn to false disables that behavior.
The email, password, and name fields are required in the documented example. An image can also be supplied as an optional profile image.
Follow-up: What password constraint should be considered? The default minimum is 8 characters and the maximum is 128.
The method returns an object that can be destructured into data and error. Application code should check error before using the returned data.
Follow-up: Which server endpoint handles the operation? Better Auth documents POST /sign-up/email for this client method.
signIn.emailsignOutemailAndPassword.enabledauthClient