Posts

Showing posts with the label 2FA in php

Google 2 Factor Authentication using PHP

Google 2 Factor Authentication using PHP In this tutorial, I have explained how to add Two factor authentication with Google  Authenticator and PHP . You can check official Google-Authentication project here. Github Follow the steps. Step 1) Create a unique secret code of length 16 characters. PHPGangsta provides wrapper class for Google Authenticator. You can download using composer. curl -sS https://getcomposer.org/installer | php php composer.phar require phpgangsta/googleauthenticator:dev-master Use the below code to generate the secret code. <?php $authenticator = new PHPGangsta_GoogleAuthenticator(); require 'vendor/autoload.php'; $secret = $authenticator->createSecret(); We need to prepare a QR code using the secret. If you want to read more about QR code generation for Google Authenticator. Github Wiki  echo "Secret: ".$secret; ?> Step 2) Create a QR code withe the generated secret. You can use any QR...