Overview
Some operations, like signing transactions or exporting keys, are protected by MFA. Knowing which operations trigger MFA helps you design better UX (like showing lock icons) and handle edge cases.You might need this guide to:
- Show lock icons on buttons that trigger MFA
- Build a custom MFA modal instead of the default
- Handle MFA differently in different parts of your app
- Disable automatic MFA prompts entirely
CDPReactProvider with default settings, MFA verification is handled automatically for enrolled users. Note that MFA is not enforced until users enroll (add the EnrollMfaModal component so users can set up MFA).MFA-protected operations
These operations trigger MFA verification when the user is enrolled:EVM
EVM
signEvmHashsignEvmTypedDatasignEvmMessagesignEvmTransactionsendEvmTransactionsendUserOperationcreateEvmKeyExportIframe
Solana
Solana
signSolanaMessagesignSolanaTransactionsendSolanaTransactioncreateSolanaKeyExportIframe
Checking MFA status
UseisMfaRequired() to check if the user needs to verify before protected operations:
isMfaProtectedAction() to check if a specific action triggers MFA (useful for showing lock icons):
Custom handling
For applications using the SDK directly (withoutCDPReactProvider), or if you want a custom MFA UI, register a listener to intercept MFA requirements.
- React hooks
- Core SDK
For complete UI implementations with verification flow, error handling, and state management, see the MFA section in the cdp-hooks reference.
Disabling defaults
To handle MFA entirely yourself, disable the automatic modal at the provider level:ExportWalletModal have built-in MFA flows. To handle MFA separately, use skipMfa:
Troubleshooting
MFA not triggering automatically
MFA not triggering automatically
Check:
- You’re using
CDPReactProviderfrom@coinbase/cdp-react mfa.disableAutoPromptis not set totrue- The user is enrolled in MFA (
isEnrolledInMfa(user)returnstrue) - If using custom handling, verify you’ve registered a listener
Operation fails after verification
Operation fails after verification
- Ensure the verification completed successfully before retrying
- Check that the user hasn’t been signed out
- Verify the operation parameters are still valid
Scoped handler not responding
Scoped handler not responding
- Ensure the
refis attached to a DOM element that contains the triggering action - Verify the component with
useRegisterMfaListeneris mounted when the action occurs