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

# Enable MFA

The `enableMFA` method triggers multi-factor authentication (MFA) setup for users, adding an additional recovery factor to protect wallet access. It accepts an optional `LoginParams` parameter.

- If you use a default sign-in provider, call `enableMFA()` without arguments.
- If you use a custom JWT auth connection, pass a `LoginParams` object that includes the valid JWT token.

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

- Default Auth Connection
- Custom JWT Auth Connection

```
do {
  let isMFAEnabled = try await web3Auth.enableMFA()
} catch {
  print(error.localizedDescription)
  // Handle Error
}

```

warning

Single-factor authentication (SFA) mode users (authenticated directly via `idToken`) cannot enable MFA. The `enableMFA` call throws an error if the user signed in using a JWT token directly.

```
do {
    let loginParams = LoginParams(
        authConnection: .CUSTOM,
        authConnectionId: "your-auth-connection-id",
        idToken: "your_jwt_token"
    )

    let isMFAEnabled = try await web3Auth.enableMFA(loginParams)
} catch {
    print(error.localizedDescription)
    // Handle Error
}

```
