Mutations
useAddPasskey
Register a new passkey for the current user.
Prompts the WebAuthn ceremony then refetches the passkey list on success.
Usage
import { authClient } from "@/lib/auth-client"
import { useAddPasskey } from "@better-auth-ui/react/plugins/passkey"
const { mutate: addPasskey, isPending } = useAddPasskey(authClient)
addPasskey({ name: "MacBook Pro" })useAddPasskey requires the Better Auth passkey plugin. Import your configured authClient. It already carries the plugin methods from createAuthClient.
Options factory
import { addPasskeyOptions } from "@better-auth-ui/core/plugins/passkey"
import { useMutation } from "@tanstack/react-query"
const { mutate } = useMutation(addPasskeyOptions(authClient))Params
Prop
Type
Last updated on