For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Enable MFA for a user

The enableMFA method triggers the MFA setup flow for the signed-in user. It opens a browser where the user sets up their MFA factors.

The method takes optional LoginParams. You don't need to pass them for most apps; the SDK uses the current session.

The method returns a bool that indicates whether MFA was set up. It throws if MFA is already enabled for the user.

Not available for idToken sessions

In v8, enableMFA and manageMFA throw when the current session was created with idToken (custom JWT sign-in such as Firebase), or when you pass LoginParams with idToken. On Android the error is ENABLE_MFA_NOT_ALLOWED; on iOS it's enabledMfaNotAllowed. Users who signed in with an OAuth flow, including custom connections configured with authConnectionConfig and ExtraLoginOptions, can use MFA.

Usage​

Usage
try {
final bool isMfaSetup = await Web3AuthFlutter.enableMFA();
} on PlatformException catch (e) {
log(e.message ?? e.toString());
}
On this page