From fd3cf37febb90cd50fc43ac694f10c21d45e4dbe Mon Sep 17 00:00:00 2001 From: paulr Date: Tue, 7 Dec 2010 02:33:58 +1100 Subject: [PATCH] token counter fix --- lib/ga4php.php | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/lib/ga4php.php b/lib/ga4php.php index 6c4e156..784a918 100644 --- a/lib/ga4php.php +++ b/lib/ga4php.php @@ -250,7 +250,10 @@ abstract class GoogleAuthenticator { $data = $this->internalGetData($user); $toktype = $data["tokentype"]; $key = $this->helperhex2b32($data["tokenkey"]); - $counter = $data["tokencounter"]; + + // token counter should be one more then current token value, otherwise + // it gets confused + $counter = $data["tokencounter"]+1; $toktype = strtolower($toktype); if($toktype == "hotp") { $url = "otpauth://$toktype/$user?secret=$key&counter=$counter"; -- 1.7.0.4