useAddPasskey

A custom hook to handle the addition of a passkey to an already authenticated account, which includes executing a mutation with optional parameters.

Import

1import { useAddPasskey } from "@account-kit/react";

Usage

1import { useAddPasskey } from "@account-kit/react";
2
3const { addPasskey, isAddingPasskey, error } = useAddPasskey({
4 // these are optional
5 onSuccess: () => {
6 // do something on success
7 },
8 onError: (error) => console.error(error),
9});

Parameters

mutationArgs

UseAddPasskeyMutationArgs Optional arguments for the mutation used for adding a passkey. ref

Returns

UseAddPasskeyResult An object containing the addPasskey function, a boolean isAddingPasskey to track the mutation status, and any error encountered. ref