Mutations
useSignInEmailOtp
Complete passwordless sign-in with an emailed code.
Refetches the session on success. Send the code with useSendVerificationOtp({ type: "sign-in" }) first.
Usage
import {
type EmailOtpAuthClient,
useAuth,
useSignInEmailOtp
} from "@better-auth-ui/react"
const { authClient } = useAuth()
const { mutate: signInEmailOtp } = useSignInEmailOtp(
authClient as EmailOtpAuthClient
)
signInEmailOtp({
email: "[email protected]",
otp: "123456"
})useSignInEmailOtp requires the Better Auth emailOTP plugin. Cast authClient to EmailOtpAuthClient so TypeScript picks up the plugin-extended method signature.
Options factory
import { signInEmailOtpOptions } from "@better-auth-ui/react"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(signInEmailOtpOptions(authClient))Params
Prop
Type
Last updated on