GoogleAuthenticator icon indicating copy to clipboard operation
GoogleAuthenticator copied to clipboard

i cant key the code correctly

Open roderisland opened this issue 9 years ago • 1 comments

hi sir, my timezone is gmt+8, i modify the timezone and pass the param to $timeslice, but i keep keyin the code and keep cant match the code with my phone, anything i did it wrong? thank you.

createSecret(); echo "Secret is: ".$secret."\n\n"; $qrCodeUrl = $ga->getQRCodeGoogleUrl('Blog', $secret); echo "Google Charts URL for the QR-Code: ".$qrCodeUrl."\n\n"; $oneCode = $ga->getCode($secret,$unixtimestamp); echo "Checking Code '$oneCode' and Secret '$secret':\n\n"; $code=$_POST['txtCode']; echo $code."
"; $checkResult = $ga->verifyCode($secret, $code,30,$unixtimestamp); // 2 = 2*30sec clock tolerance if ($checkResult) { echo 'OK'; } else { echo 'FAILED'; } ?>

roderisland avatar Jul 06 '16 02:07 roderisland

I guess the problem is that you give the current timestamp to the methods getCode() and verifyCode(). You need to give it the "time slice", which is a timestamp devided by 30... Maybe it works then?

PHPGangsta avatar Oct 08 '16 13:10 PHPGangsta