Most ECommerce websites these days allow users to login from their social network accounts like Facebook, LinkedIn, Google. Instead of the traditional way of registering a new user, this method is preferred because of the following reasons:

  • Security
    • Your social media provider takes care of the authenticity and security of the account rather than you writing lots of codes
  • Spam protection
    • Users will not be able to spam your website with fake accounts as they will always have to create accounts at Facebook or Google and go through the entire process of verifying the account
  • Nice and easy implementation
    • Implementing Login using social media is very simple and easy and does not require heavy coding and database management on your side
Social Login


Generating the Google Login Link for website

This link is generated in php for your website which you can place anywhere in the Webpage. Upon clicking this link, the user is redirected to the Google Login page. Upon successful authentication from Google, we receive a User Object which contains details about the user like Name, Email, Profile Picture etc.

  1. Download a package GoogleSRC from this link (Download here)
  2. Extract this folder and place it in your website directory.
  3. Create a file called googleConfig.php in the same directory

  4. Create a file googleLogin.php – This file should be called on your webpage to receive the login URL. Incase the user is already logged in, this file will redirect us to the “”  which is responsible to access all the google login data about the user.

  5. Once the above file is implemented, if the user is not logged in, the variable $googleLoginURL  holds the login url. You can place this link anywhere in your website behind a google login image to be clicked using anchor tag

  6. Upon clicking this link and successful login, the User is redirected to earlier mentioned file googleredirect.php . Create that file as below

  7. At the end of above implementation, the array $userData holds all the user information that Google can provide to us. You can convert this data into JSON and send this to your webservice for storage. Or simply store this data in PHP Session as per your implementation. After completion of the above page, you can redirect the user to your desired page on the website like homepage, or the page where login was initiated.

Setup Google Login in Developer Console

  • Go to link
  • Top left near Google Logo – Click on Create a Project
  • Follow the instructions on screen and create the project.
  • Go to credentials manager Link Here
  • Click on Create Credentials button
  • Select OAuth client ID
  • Next page select Web Application
  • Provide details about your website urls which will be accessing the google login platform
  • Click Create
  • You will receive a clientId and Client secret which needs to be placed in the file googleConfig.php  mentioned above.
  • Et ‘Voila . Login is completed. Try login on your site and let us know in comments if you face any issue
  • link directory script
    September 25, 2017 at 1:52 pm

    This is actually a good influencing view on this particular idea. And I’d like you to know that I’m really glad you shared your thoughts plus knowledge and I find that i agree. I truly truly appreciate the straightforward writing along with the focus you have invested writing this posting. Loads of thanks yous for that good work plus very good luck with the website, I most certainly will be awaiting new topics within the future.

  • drag battle racing hack
    November 6, 2017 at 9:48 pm

    I truly enjoy looking through on this web site , it holds superb content .


Leave a Comment

Your email address will not be published. Required fields are marked *