createMfaChallenge method

Future<MfaChallenge> createMfaChallenge({
  1. required AuthenticationFactor factor,
})

Create 2FA Challenge

Begin the process of MFA verification after sign-in. Finish the flow with updateMfaChallenge method.

Implementation

Future<models.MfaChallenge> createMfaChallenge(
    {required enums.AuthenticationFactor factor}) async {
  const String apiPath = '/account/mfa/challenge';

  final Map<String, dynamic> apiParams = {
    'factor': factor.value,
  };

  final Map<String, String> apiHeaders = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.post,
      path: apiPath, params: apiParams, headers: apiHeaders);

  return models.MfaChallenge.fromMap(res.data);
}