Tagged: 2 factor authentication php

PHP Google Two Factor Authentication With CodeIgniter 3 0

PHP Google Two Factor Authentication With CodeIgniter 3 Example

Today, We want to share with you PHP Google Two Factor Authentication With CodeIgniter 3 Example.In this post we will show you PHP Integrating Two-Factor Authentication with CodeIgniter – google 2 factor authentication new phone, hear for Integrating Google Two-Factor Authentication with CodeIgniter 3 we will give you demo and example for implement.In this post, we will learn about How to Implement Google Two Factor Authentication Login In PHP with CodeIgniter 3 with an example.

PHP Google Two Factor Authentication With CodeIgniter 3 Example

There are the Following The simple About PHP Google Two Factor Authentication With CodeIgniter 3 Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP CodeIgniter 3 Google Two Factor Authentication Example, so the Google 2-Step Verification(enable two factor authentication gmail) for this example is following below.

Enable two factor authentication gmail

google 2 factor authentication new phone

How To Works For 2 factor authentication php

PHP Google Two Factor Authentication With CodeIgniter 3 Example Tutorials - PHP Google Two Factor Authentication With CodeIgniter 3

PHP Google Two Factor Authentication With CodeIgniter 3 Example Tutorials

Google Two-factor Authentication Tutorial for Codeigniter in Simple our PHP Based CodeIgniter Application is a very simple and easy process. The Google two-factor authentication with generated uniq key will help We to secure your Authentication Simple our admin main login panel with very high secure particular time based an extra layer of main protection. Even if any hackers or unauthorized persona got Simple our main username as well as storng password they data can not log in unless they main know Simple our uniq key or retrive Simple our smart mobile or phone which has connected to google Authenticator app.

Therefor let’s step by step start. The simple main phased is simple latest version of the downloading your system Integrating Google Two-Factor Authentication with CodeIgniter 3 from GitHub. It is a called all the Authentication third party libs and all the relavents methods included but since it has main mind our main BSD Based license, so We can We use that freely in Simple our main any commercial web or mobile application. We can simple google authenticator codeigniter Download from here.

And now, We download it then simple all the source code simple copy this main file GoogleAuthenticator.php file to Simple our codeigniter web application/libraries stored on folder.and Then this file open that file in any you best used editor like notepad++ and some change its PHP Based codeigniter class name to like as GoogleAuthenticator.

And then we have our CodeIgniter library. Now use it in Simple our login function like this,

function login(){

        $this->load->library('GoogleAuthenticator');
        
		//PHP Google Two Factor Authentication With CodeIgniter 3 Example
        //USER Interface Form validation source codes
        $setting = array(
            array(
                'field' => 'uername',
                'label' => 'user Name',
                'rules' => 'trim|required|xss_clean',
                'errors' => array('required' => 'Please Enter Your Username', 'xss_clean' => 'cant inject malicious uniq code')
            ),
            array(
                'field' => 'password',
                'label' => 'password',
                'rules' => 'trim|required|xss_clean',
                'errors' => array('required' => 'Please Enter Your Password.', 'xss_clean' => 'cant inject malicious uniq code')
            ),
            array(
                'field' => 'token',
                'label' => 'Google Two-factor token',
                'rules' => 'trim|xss_clean|max_length[6]',
                'errors' => array('required' => 'Please Enter Your Two Factor Code.', 'xss_clean' => 'cant inject malicious uniq code')
            ),

        );

        $this->form_validation->set_rules($setting);
        if ($this->form_validation->run() == FALSE) 
        {

             $this->load->view('signinpage');

        }
        else
        {
            // google authenticator codeigniter 2 factor authentication source codes

            $googleAuthObj = new GoogleAuthenticator();
            $authSecretKey = "JDBC6PLIJDKDSPNM2L" ; //$googleAuthObj->createSecret();
            $oneCode = $this->input->post('token');
            
            $token = $googleAuthObj->getCode($authSecretKey);
                    
            $googleAuthResults = $googleAuthObj->verifyCode($authSecretKey, $oneCode, 2); // 2 = 2*30sec clock tolerance
	    if (!$googleAuthResults)
            {
               
                $this->index('Sorry Your GoogleAuthenticator Two-factor token Failed'); // main page index function here simple load signin page view
               
            }
            else
            {    
                // Two-factor Source code if results success and then now We simple steps for Simple our username as well as Simple our password Login Authentication with verification
            } 
        }
}

You can make a google generated a new secure key by your calling below some PHP or CodeIgniter function.

$googleAuthObj->createSecret();

Once We make a simple google key download Google Authenticator from products of the google your play store application and setup install Simple our main unique key.

Important Note :The Google algorithm is time-based. A new unique source code is generated every moments means 30 seconds as well as each simple code is valid for main 90 seconds only. Therefor We must ensure that Simple our mobile or smart phone time based and Simple our server sure time is exactly same otherwise, it source code won’t work.Please Comment below if We stuck or encountered any types of the problem or I am freely free happy to help you.

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Google Two Factor Authentication With CodeIgniter 3 Example.
I would like to have feedback on my Pakainfo.com blog with details of the 2 factor authentication php.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.