BETTER-AUTH. UI
Mutations

useChangeEmail

Change the authenticated user's email address.

Refetches the session on success so the new email surfaces everywhere that reads useSession / useUser.

Usage

import { useAuth, useChangeEmail } from "@better-auth-ui/react"

const { authClient } = useAuth()
const { mutate: changeEmail } = useChangeEmail(authClient)

changeEmail({
  newEmail: "[email protected]",
  callbackURL: "/account"
})

Options factory

import { changeEmailOptions } from "@better-auth-ui/react"
import { useMutation } from "@tanstack/react-query"

const { mutate } = useMutation(changeEmailOptions(authClient))

Params

Prop

Type

Last updated on

On this page