> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useDeletePasskey

<Card title="Recommended: JavaScript SDK with React Hooks" icon="react" color="#4779FE">
  For new React apps, we recommend the JavaScript SDK with React Hooks (`@dynamic-labs-sdk/react-hooks`) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the [React quickstart (JavaScript SDK)](/javascript/reference/react-quickstart) to get started.
</Card>

### Summary

This hook provides a way for developers to delete a passkey for an authenticated user.

The hook needs to be initialized within a child of [DynamicContextProvider](/react/reference/providers/dynamiccontextprovider).

<Note>
  If passkey MFA is enabled, the user will need to authenticate with MFA before deleting a passkey.
</Note>

### Usage

Available methods:

* `deletePasskey`: Delete a passkey for the authenticated user.

### Usage

```TypeScript theme={"system"}
import { useDeletePasskey } from '@dynamic-labs/sdk-react-core';

const App = () => {
  const deletePasskey = useDeletePasskey();

  return (
    <button
      onClick={() => deletePasskey('passkeyId')}
    >
      Delete Passkey
    </button>
  );
};
```

#### Example with MFA

See [action-based MFA](/react/authentication-methods/mfa/overview#implementation-2) for more information on completing the MFA flow. This example uses the [usePromptMfaAuth](/react/reference/hooks/login-user-management/usepromptmfa) hook to prompt the user to authenticate with MFA via the Dynamic UI.

```TypeScript theme={"system"}
import { useDeletePasskey, usePromptMfaAuth } from '@dynamic-labs/sdk-react-core';

const App = () => {
  const promptMfaAuth = usePromptMfaAuth();
  const deletePasskey = useDeletePasskey();

  const handleDeletePasskey = async () => {
    try {
      await promptMfaAuth({
        createMfaToken: true,
      });
      await deletePasskey('passkeyId');
    } catch (error) {
      console.error('Failed to delete passkey:', error);
    }
  };

  return (
    <button
      onClick={handleDeletePasskey}
    >
      Delete Passkey
    </button>
  );
};
```
