You are here

public function AuthenticationAPIHandler::register in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Same name and namespace in other branches
  1. 8 src/AuthenticationAPIHandler.php \Drupal\miniorange_2fa\AuthenticationAPIHandler::register()

File

src/AuthenticationAPIHandler.php, line 65

Class

AuthenticationAPIHandler

Namespace

Drupal\miniorange_2fa

Code

public function register(MiniorangeUser $user, $registrationType, $secret, $token, $quesAnsList) {
  $fields = array(
    'customerKey' => $user
      ->getCustomerId(),
    'username' => $user
      ->getUsername(),
    'registrationType' => $registrationType,
    'secret' => $secret,
    'otpToken' => str_replace(" ", "", $token),
    'questionAnswerList' => $quesAnsList,
  );
  $json = json_encode($fields);
  $url = MoAuthConstants::getBaseUrl() . MoAuthConstants::$AUTH_REGISTER_API;
  return MoAuthUtilities::callService($this->customerId, $this->apiKey, $url, $json);
}