> ## 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.

# usePromptMfaAuth

> [card] Recommended: JavaScript SDK with React Hooks
>
> 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)](https://docs.dynamic.xyz/docs/javascript/reference/react-quickstart.md) to get started.

### Summary

This hook provides a way for clients to prompt the user to authenticate with MFA via the Dynamic UI. It supports both the legacy `createMfaToken` flow and the recommended `requestedScopes` flow for [elevated access tokens](https://docs.dynamic.xyz/docs/auth/step-up-auth.md).

The hook needs to be initialized within a child of [DynamicContextProvider](https://docs.dynamic.xyz/docs/react/reference/providers/dynamiccontextprovider.md).

### Parameters

| Property | Type | Description |
| - | - | - |
| `requestedScopes` | `TokenScope[]` | Scopes to request an elevated access token for (recommended) |
| `createMfaToken` | `boolean` | @deprecated — Create a single-use MFA token. Use `requestedScopes` instead. See [migration guide](https://docs.dynamic.xyz/docs/get-started/migrations/api/2026_04_01-mfa-migration.md). |

### Usage

#### With elevated access tokens (recommended)

```tsx theme={"system"}
import { usePromptMfaAuth } from '@dynamic-labs/sdk-react-core';
import { TokenScope } from '@dynamic-labs/sdk-api-core';

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

  return (
    <button
      onClick={() => promptMfaAuth({
        requestedScopes: [TokenScope.Walletexport],
      })}
    >
      Prompt MFA
    </button>
  );
};
```

#### With MFA token (deprecated)

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

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

  return (
    <button
      onClick={() => promptMfaAuth({
        createMfaToken: true,
      })}
    >
      Prompt MFA
    </button>
  );
};
```

### Related

* [Step-Up Authentication](https://docs.dynamic.xyz/docs/react/authentication-methods/step-up-auth/overview.md)
* [useStepUpAuthentication](https://docs.dynamic.xyz/docs/react/reference/hooks/login-user-management/usestepupauthentication.md)
* [Action-Based MFA](https://docs.dynamic.xyz/docs/react/authentication-methods/mfa/action-based.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.