BETTER-AUTH. UI
Mutations

verifyPhoneNumberOptions

Verify a phone code or update the current user's phone number.

Options factory

import {
  type PhoneNumberAuthClient,
  useAuth,
  verifyPhoneNumberOptions
} from "@better-auth-ui/solid"
import { createMutation } from "@tanstack/solid-query"

const { authClient } = useAuth()
const verify = createMutation(() =>
  verifyPhoneNumberOptions(authClient as PhoneNumberAuthClient)
)

verify.mutate({
  phoneNumber: "+12025550123",
  code: "123456"
})

Pass updatePhoneNumber: true while authenticated to replace the current phone number. Session data refreshes after success.

Params

Prop

Type

Last updated on

On this page