PHPGangsta / GoogleAuthenticator

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

What is meaning of 'Blog' parameter in the example? #35

Closed pitometsyurii closed 7 years ago

pitometsyurii commented 8 years ago

In example.php there is mystic variable for me 'Blog'. Could you please explain what is that means and if it can be changed to other value?

$qrCodeUrl = $ga->getQRCodeGoogleUrl('Blog', $secret);

PHPGangsta commented 8 years ago

The first parameter of the function getQRCodeGoogleUrl() is a "name" for the QRCode: https://github.com/PHPGangsta/GoogleAuthenticator/blob/022046934a85217739b4e7610a37fcc8ffdf986e/PHPGangsta/GoogleAuthenticator.php#L95

The exact format is described here: https://github.com/google/google-authenticator/wiki/Key-Uri-Format

If you scan the resulting QRCode image with your mobile phone, the name will be displayed, like this: Image Authenticator

The name helps you to distinguish the TOTP-Token in the Authenticator App, if you have multiple ones. It can be an email address, or a URL, or anything.