associateSoftwareToken method

Future<String?> associateSoftwareToken()

This is used to associate a TOTP MFA

Implementation

Future<String?> associateSoftwareToken() async {
  if (_signInUserSession?.isValid() ?? false) {
    final data = await client!.request(
      'AssociateSoftwareToken',
      {'AccessToken': _signInUserSession!.getAccessToken().getJwtToken()},
    );

    return data['SecretCode'];
  } else if (_session != null) {
    final data = await client!.request(
      'AssociateSoftwareToken',
      {'Session': _session},
    );

    _session = data["Session"];

    return data['SecretCode'];
  }

  throw Exception("User is not authenticated");
}