Mutations
useDisableTwoFactor
Turn two-factor off.
Refetches the session so user.twoFactorEnabled is up to date.
Usage
import {
type TwoFactorAuthClient,
useAuth,
useDisableTwoFactor
} from "@better-auth-ui/react"
const { authClient } = useAuth()
const { mutate: disableTwoFactor } = useDisableTwoFactor(
authClient as TwoFactorAuthClient
)
disableTwoFactor({ password: "current-password" })useDisableTwoFactor requires the Better Auth twoFactor plugin. Cast authClient to TwoFactorAuthClient so TypeScript picks up the plugin-extended method signature.
Options factory
import { disableTwoFactorOptions } from "@better-auth-ui/react"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(disableTwoFactorOptions(authClient))Params
Prop
Type
Last updated on