Mutations
useSignInPhoneNumber
Sign in with a phone number and password.
import {
type PhoneNumberAuthClient
} from "@better-auth-ui/core/plugins/phone-number"
import { useAuth } from "@better-auth-ui/react"
import { useSignInPhoneNumber } from "@better-auth-ui/react/plugins/phone-number"
const { authClient } = useAuth()
const { mutate: signInPhoneNumber } = useSignInPhoneNumber(
authClient as PhoneNumberAuthClient
)
signInPhoneNumber({
phoneNumber: "+12025550123",
password,
rememberMe: true
})With Better Auth requireVerification, an unverified credential returns PHONE_NUMBER_NOT_VERIFIED and starts phone verification. This password-based method follows configured 2FA.
Options factory
import { signInPhoneNumberOptions } from "@better-auth-ui/core/plugins/phone-number"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(signInPhoneNumberOptions(authClient))Params
Prop
Type
Last updated on