public function verify($authyId, $token) {
    $data = array(
      'token'    => $token,
      'authy_id' => $authyId,
    );


    $result = $this->apiCall('verify', $data);

    if($result === false) {
      $this->lastError = 'AUTHY_SERVER_ERROR';
      return false;
    }

    if(isset($result->errors)) {
      if(isset($result->errors->message) && $result->errors->message == 'token is invalid') {
        $this->lastError = 'AUTHY_SERVER_BAD_OTP';
      } elseif(isset($result->errors->api_key)) {
        $this->lastError = 'AUTHY_SERVER_INVALID_API_KEY';
      } else {
        $this->lastError = 'AUTHY_SERVER_INVALID_DATA';
      }
      return false;
    }

    if(isset($result->token) && $result->token == 'is valid') {
      return true;
    }

    return false;
  }
public function verify($authyId, $token) {
    $data = array(
      'token'    => $token,
      'authy_id' => $authyId,
    );


    $result = $this->apiCall('verify', $data);

    if($result === false) {
      $this->lastError = 'AUTHY_SERVER_ERROR';
      return false;
    }

    if(isset($result->errors)) {
      if(isset($result->errors->message) && $result->errors->message == 'token is invalid') {
        $this->lastError = 'AUTHY_SERVER_BAD_OTP';
      } elseif(isset($result->errors->api_key)) {
        $this->lastError = 'AUTHY_SERVER_INVALID_API_KEY';
      } else {
        $this->lastError = 'AUTHY_SERVER_INVALID_DATA';
      }
      return false;
    }

    if(isset($result->token) && $result->token == 'is valid') {
      return true;
    }

    return false;
  }
public function verify ( $ authyId , $ token ) { $ data = array ( 'token' => $ token , 'authy_id' => $ authyId , ) ; $ result = $ this -> apiCall ( 'verify' , $ data ) ; if ( $ result === false ) { $ this -> lastError = 'AUTHY_SERVER_ERROR' ; return false ; } if ( isset ( $ result -> errors ) ) { if ( isset ( $ result -> errors -> message ) && $ result -> errors -> message == 'token is invalid' ) { $ this -> lastError = 'AUTHY_SERVER_BAD_OTP' ; } elseif ( isset ( $ result -> errors -> api_key ) ) { $ this -> lastError = 'AUTHY_SERVER_INVALID_API_KEY' ; } else { $ this -> lastError = 'AUTHY_SERVER_INVALID_DATA' ; } return false ; } if ( isset ( $ result -> token ) && $ result -> token == 'is valid' ) { return true ; } return false ; }
Verify a Authy OTP.

@param int $authyId
User Authy ID. @see \phpSec\Auth\Authy::userNew().

@param int $token
User supplied OPT/token.

@return boolean
Return true if a valid Authy token is supplied, false on any errors.
@see \phpSec\Auth\Authy::$lastError.
Verify a Authy OTP .