Enable MFA
The enableMFA method is used to trigger MFA setup flow for users. The method takes LoginParams which will be used during custom auth connections. If you are using default login providers, you don't need to pass LoginParams. If you are using custom JWT auth connections, you need to pass the valid JWT token in LoginParams as well.
Usage
- Default Auth Connection
- Custom JWT Auth Connection
do {
let isMFAEnabled = try await web3Auth.enableMFA()
} catch {
print(error.localizedDescription)
// Handle Error
}
warning
SFA mode users (authenticated via idToken) cannot enable MFA. The enableMFA call will throw an error if the user was authenticated 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
}