Yubico / php-yubico

PHP class for Yubico authentication
https://developers.yubico.com/php-yubico
BSD 3-Clause "New" or "Revised" License
129 stars 41 forks source link

NO_VALID_ANSWER #14

Open tylermenezes opened 9 years ago

tylermenezes commented 9 years ago

This library doesn't seem to work for me -- it always returns "NO_VALID_ANSWER" no matter what.

In fact, it's not just me -- your own demo page doesn't work: https://demo.yubico.com/php-yubico/demo.php

NiklasBr commented 9 years ago

It is currently working. Try changing the OTP to a real Yubikey OTP string.

NO_VALID_ANSWER seems to be the response when it is not a password replay nor a valid OTP.

charlesshoults commented 4 years ago

I too am having issues with no valid answer. I have an API key (clientId, secretKey) and am taking otp as an input variable, but it doesn't seem to be working. I assumed that the ID and secret was added in place of the 24 and FOOBAR, as shown below.

require_once 'assets/scripts/Auth_Yubico-2.6/Yubico.php'; if(isset($_GET["otp"])) { $clientId = "24"; $secretKey = "FOOBAR="; $otp = $_GET['otp']; $yubi = new Auth_Yubico(clientId, secretKey); $auth = $yubi->verify($otp);

    if (PEAR::isError($auth)) {
            print "<p>Authentication failed: " . $auth->getMessage();
            print "<p>Debug output from server: " . $yubi->getLastResponse();
    } else {
            print "<p>You are authenticated!";
    }

}

Authentication failed: NO_VALID_ANSWER

Debug output from server:

charlesshoults commented 4 years ago

I figured out my issue. On the line where I'm referring to the previously set clientId and secretKey, I need to have a $ for the variable.