> ## 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 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 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](/overview/authentication/step-up-auth).

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

### 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](/overview/migrations/api/2026_04_01-mfa-migration). |

### 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](/react/authentication-methods/step-up-auth/overview)
* [useStepUpAuthentication](/react/reference/hooks/login-user-management/usestepupauthentication)
* [Action-Based MFA](/react/authentication-methods/mfa/action-based)
