PHPGangsta / GoogleAuthenticator

PHP class to generate and verify Google Authenticator 2-factor authentication
http://phpgangsta.de/4376
BSD 2-Clause "Simplified" License
2.26k stars 699 forks source link

Google Auth app and system generated codes are different #58

Open rnkhouse opened 6 years ago

rnkhouse commented 6 years ago

I entered secret in google authenticator app. It generates random code in every few seconds. But, when I match with my code it's different.

$this->load->library('GoogleAuthenticator');
$oneCode = $this->googleauthenticator->getCode($secret);

$oneCode is different than I see in google app.

PHPGangsta commented 6 years ago

Most often it's a time problem, so the clock is not synchronized between the mobile phone and the server. Please check if both systems have the same time, then they should generate the same code (with the same secret used).

zxyaust commented 3 years ago

that is a problem indid. When the secret is long(maybe morethan 16length),The code is different from google app.