Yubico Forum

...visit our web-store at store.yubico.com
It is currently Tue Jan 30, 2018 11:54 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Aug 23, 2011 9:26 am 
Offline

Joined: Mon Aug 22, 2011 2:21 pm
Posts: 2
Ive been reading a lot about the Yubikey the last week and found a PDF slideshow that listed a URL accessing the API in a simple manner so I produced this PHP code using it :

Code:

<?php

$otp      = "cccccccvfckdvfblijjfctibtlrbejjddjiligvbkevu";   // OTP from Yubikey
$yubikeyid   = substr($otp, 0, 12);               // Grab first 12 chars for unique userid

$apiserver1 = "https://api.yubico.com/wsapi/verify?id=1&otp=";      // Yubico API server

$serverresponse = file_get_contents($apiserver1 . $otp);      // Access server using concat string of URL plus OTP
$pos = strpos($serverresponse, "status=OK");            // Check the server response for "status=ok"

if ($pos === false) {                     // If the string is not returned there is an error
    echo "$yubikeyid - Invalid<BR><BR> - $serverresponse";
} else {                        // Else the string was found and the Yubikey is valid, now check the userid etc...
    echo "$yubikeyid -  OK<BR><BR> - $serverresponse";
}

?>



Is this too simplistic / a bad idea?

Thanks
R.


Top
 Profile  
Reply with quote  

Share On:

Share on Facebook FacebookShare on Twitter TwitterShare on Tumblr TumblrShare on Google+ Google+

PostPosted: Tue Dec 06, 2011 11:06 am 
Offline

Joined: Tue Dec 06, 2011 10:46 am
Posts: 7
Did you manage to make that example work ?

Regards.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 07, 2011 2:51 pm 
I'd recommend using the PHP validation client. See the ReadMe for a super-simple example.

http://code.google.com/p/php-yubico/

/Fredrik


Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group