BETTER-AUTH. UI
Mutations

enableTwoFactorOptions

Start two-factor enrollment.

Requires the Better Auth two-factor plugin. If TypeScript cannot infer the plugin methods from your client, type or cast authClient as TwoFactorAuthClient from @better-auth-ui/solid.

Resolves with the TOTP URI and the backup codes. Unless the server sets skipVerificationOnEnable, two-factor only becomes active once a TOTP code verifies.

Options factory

import { enableTwoFactorOptions } from "@better-auth-ui/solid"
import { createMutation } from "@tanstack/solid-query"

const enable = createMutation(() => enableTwoFactorOptions(authClient))

enable.mutate({ password: "current-password" })

Params

Prop

Type

Last updated on

On this page