A simple demo of Google Authenticator implementation with PHP. Use this to implement a 2-factor login on your website or application with Google Authenticator.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


PHP Google Authenticator Demo

This is not meant as a fully functional application. It is only to demonstrate how to make use of Google Authenticator Mobile App with your website as a 2-Factor login system, or as a one-time password.

This simple PHP script demonstrates the implementation of Google Authenticator with PHP. To utilise this, you will need to download the Google Authenticator app. This script also utilizes Google Authenticator Library from PHPGangsta

PHPGansta Google Authenticator Library https://github.com/PHPGangsta/GoogleAuthenticator

Google Authenticator

How To Use

First of all, check the script. That is where the goodies are.

There is only one thing to modify in login.php. Just change the $app_name variable to reflect your application.

To test it, point your browser to login.php and just follow the login process.


Just to demonstrate on how this works, the script will store the users' secret key in a text file which is named by hashing the email address with a MD5. So later, you will have some extra files on your web folder. Of course, this is not the ideal way of storing the users' secret key. You better use a database, a folder below the web public, or any other methods.

This whole project is meant as a demo.