PHPGangsta / GoogleAuthenticator

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

Question: How do i check the Code from the App Google Authenticator? #89

Open theredcmdcraft opened 3 years ago

theredcmdcraft commented 3 years ago

I got a code from the App. like 050 221. How do i check the Code if it is right?

greenreader9 commented 2 years ago

`$authenticator = new PHPGangsta_GoogleAuthenticator();

$secret = '3JMZE4ASZRIISJRI'; //The users secret key $key= '183036' ; //The number generated by app.

$checkKey = $authenticator->verifyCode($secret, $key, 0);

if ($checkKey ) { echo 'Validated Succesfully';

} else { echo 'FAILED'; }`