setPreferredMFA method
Set prefered MFA Method which can be one of the following 'SOFTWARE_TOKEN_MFA' | 'SMS_MFA' | 'NOMFA'
Implementation
Future<bool> setPreferredMFA(String mfaMethod) async {
IMfaSettings? smsMfaSettings;
IMfaSettings? softwareTokenMfaSettings;
switch (mfaMethod) {
case 'SOFTWARE_TOKEN_MFA':
{
softwareTokenMfaSettings =
IMfaSettings(preferredMfa: true, enabled: true);
break;
}
case 'SMS_MFA':
{
smsMfaSettings = IMfaSettings(preferredMfa: true, enabled: true);
break;
}
case 'NOMFA':
{
smsMfaSettings = IMfaSettings(preferredMfa: false, enabled: false);
softwareTokenMfaSettings =
IMfaSettings(preferredMfa: false, enabled: false);
break;
}
default:
throw Exception('No valid MFA method provided');
}
return setUserMfaPreference(smsMfaSettings, softwareTokenMfaSettings);
}