> For the complete documentation index, see [llms.txt](/llms.txt).

# useEnableMFA

Hook to enable Multi-Factor Authentication (MFA) using Web3Auth.

info

Please note that this hook doesn't work for external wallet logins. It only works for social login embedded wallets.

### Import[​](#import "Direct link to Import")

```
import { useEnableMFA } from '@web3auth/modal/react'

```

### Usage[​](#usage "Direct link to Usage")

```
import { useEnableMFA } from '@web3auth/modal/react'

function EnableMFAButton() {
  const { enableMFA, loading, error } = useEnableMFA()

  return (
    <div>
      <button onClick={() => enableMFA()} disabled={loading}>
        {loading ? 'Enabling MFA...' : 'Enable MFA'}
      </button>
      {error && <div>{error.message}</div>}
    </div>
  )
}

```

### Return type[​](#return-type "Direct link to Return type")

```
import { type IUseEnableMFA } from '@web3auth/modal/react'

```

#### `loading`[​](#loading "Direct link to loading")

`boolean`

Whether the MFA enabling process is in progress.

#### `error`[​](#error "Direct link to error")

`Web3AuthError | null`

Error that occurred during the MFA enabling process.

#### `enableMFA`[​](#enablemfa "Direct link to enablemfa")

`<T>(params?: T) => Promise<void>`

Function to initiate the MFA enabling process. Accepts optional parameters depending on the MFA method or configuration required by your implementation.
