mfaRecover method

Future<bool> mfaRecover(
  1. String code
)

Implementation

Future<bool> mfaRecover(String code) async {
  try {
    _dio.options.headers['content-Type'] = 'application/json';
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    final String? email = prefs.getString('emailForRecover');
    await _dio.post('$baseUrl/frontegg/identity/resources/auth/v1/user/mfa/recover',
        data: {"recoveryCode": code, 'email': email});

    return true;
  } catch (e) {
    if (e is DioError && e.response != null) {
      throw e.response!.data['errors'][0];
    }
    throw tr('invalid_authentication');
  }
}