You are here

public function AuthenticationAPIHandler::validate in Google Authenticator / 2 Factor Authentication - 2FA 7

File

classes/AuthenticationAPIHandler.php, line 29

Class

AuthenticationAPIHandler

Code

public function validate(MiniorangeUser $user, $txId, $token, $answers = NULL) {
  $fields = array(
    'customerKey' => $user
      ->getCustomerId(),
    'username' => $user
      ->getUsername(),
    'txId' => $txId,
    'token' => str_replace(" ", "", $token),
    'authType' => $user
      ->getAuthType(),
    'answers' => $answers,
  );
  $json = json_encode($fields);
  $url = MoAuthConstants::getBaseUrl() . MoAuthConstants::$AUTH_VALIDATE_API;
  return MoAuthUtilities::callService($this->customerId, $this->apiKey, $url, $json);
}