Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Better Auth · Module

signIn.emailOtp

signIn.emailOtp() signs a user in with an email address and the one-time password sent to it. It is part of Better Auth's Email OTP plugin and supports optional first-registration profile fields.

How it works

After the user requests and receives a sign-in OTP through the Email OTP plugin, call this client method with the email address and code. Optional name and image values can supply profile details only when the OTP flow registers a new user.

Syntax

authClient.signIn.emailOtp({ email, otp, name?, image? })

Parameters

NameTypeDescription
emailstring, requiredEmail address to sign in.
otpstring, requiredOTP sent to the email.
namestring, optionalUser display name; used only when registering for the first time.
imagestring, optionalUser profile image URL; used only when registering for the first time.

Returns

The page documents the client call and its response destructuring as { data, error }; it does not specify a more detailed return schema in the fetched content.

Key points

  • Email OTP is provided by the Email OTP plugin, which also covers email verification and password reset flows.
  • Before submitting the code, request a sign-in OTP with sendVerificationOtp() and the sign-in purpose.
  • Call signIn.emailOtp() after the user enters the code received by email.

Common mistakes

  • The optional name and image fields do not update an existing user's profile; they apply only during first-time registration.

Example: Sign in with an email OTP

import { authClient } from "@/lib/auth-client";

const { data, error } = await authClient.signIn.emailOtp({
  email: "user@example.com",
  otp: "123456",
});

if (error) {
  console.error(error);
} else {
  console.log(data);
}

Submit the email and received OTP to authenticate the user.

When to use it

Sign users in without a password by validating a code sent to their email.

Passwordless authentication

Create a user's initial profile during OTP sign-in with optional name and image data.

Just-in-time registration

Use the Email OTP plugin alongside its documented verification and password-reset capabilities.

Email-based account flows

Interview questions

QWhat inputs does signIn.emailOtp require?

The method accepts the user's email and the OTP delivered to that address. It submits them to the email-OTP sign-in endpoint and returns the authentication result or an error.

Follow-up: What optional registration data can be supplied? The request may include name and image, but those values are used only when the user is registering for the first time.

QWhich endpoint does this method call?

The client method corresponds to POST /sign-in/email-otp. The email identifies the account or registration target, while otp is the one-time code sent for sign-in.

Follow-up: How would the server invoke the same operation? Use the server API's signInEmailOTP operation with the request body containing the same fields.

QWhat role does the Email OTP plugin play?

The Email OTP plugin supports passwordless sign-in by sending a one-time password to the user's email and then accepting that code through signIn.emailOtp().

Follow-up: What other plugin capabilities are documented? The same Email OTP plugin also supports email verification and password reset using one-time passwords.

  • Email OTP plugin
  • sendVerificationOtp()
  • signInEmailOTP
  • POST /sign-in/email-otp

Source: Email OTP | Better Auth. Checked 2026-10-15.