Mutations
useDisableTwoFactor
Turn two-factor off.
Refetches the session so user.twoFactorEnabled is up to date.
Usage
import type { TwoFactorAuthClient } from "@better-auth-ui/core/plugins/two-factor"
import { useAuth } from "@better-auth-ui/react"
import { useDisableTwoFactor } from "@better-auth-ui/react/plugins/two-factor"
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/core/plugins/two-factor"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(disableTwoFactorOptions(authClient))Params
Prop
Type
Last updated on