Youbikey Integration with php
Posted
by kapil
on Stack Overflow
See other posts from Stack Overflow
or by kapil
Published on 2010-03-16T08:46:30Z
Indexed on
2010/03/16
8:56 UTC
Read the original article
Hit count: 316
Hi , I am finding a problem during the youbi key integration:
$apiKey = $youbekeyvalue; //this value is coming from my form. $message = 'id=1234&otp='.$key.'';//key has been i am saving in the database for a particular user. $signature = hash_hmac('sha1', $message, $apiKey, TRUE); $signature = base64_encode($signature); $url = 'http://api.yubico.com/wsapi/verify?'.$message.'&h='.$signature.''; // $url becomes http://api.yubico.com/wsapi/verify?id=1&otp=ddkwn3kdlsh3kglskeh3kld&h=ODK20DHD92LSHGKJLSL3KSL $ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
print_r($result);
curl_close($ch);
$statusstring = stristr($result,"status=");
$finalresponse = explode("=",$statusstring);
if($finalresponse[1]=="OK") return 1; else return 0;
Every time i am using this code it is giving me the response the bad signature. Can anyone please help me out to give me the working you bi key code where i can get the status ok.
© Stack Overflow or respective owner