How To Login with Google using PHP API library
Implementing Google login system in your website is very easy with OAuth2 support, a simple and standard authorization method. With minimal line of PHP codes, we can acquire required user information from Google, and use the information to register or login users on click of a button.
Download link : https://code.google.com/p/google-api-php-client/downloads/list
Login and Process Page
You need to acquire client id, secret key and developer key from Google API console, If you are not sure how, please have a look at Creating Google API keys.
Replace Google settings with Client keys and Developer key you’ve obtained from Google, and MySql database details of your website.
You need to read comment lines in the PHP code to understand how Google login system works.
When user clicks login link, user is redirected to Google Authentication page, once user grants the basic permission to access their data, user is again redirected back to website with Authentication code. The code is used to obtain Access Token, using Access Token the application can access current user data from Google, which could be used to register and login the user.