Login with Google OAuth without using Google PHP Library

PHP

Read {count} times since 2020

Google PHP Library is very hard to use and is very long. It wasted a lot of my time. So I decided to do it manually.
I created a new library for Google OAuth in PHP.

It is very simple to use and you don’t have to worry about a thing.

FAQ

How to get a client Id and Client Secret ?

1) Go to https://code.google.com/apis/console and create a new project.
2) Fill up the form.
3) In the redirect URL’s type in the URL of the index.php in your site.
4) Add your site URL as trusted Origin.
You will now get a client Id and a Client Secret Id. Type both of those in each $client_id and $client_secret variable of Configuration section in index.php file.

What should I type in $redirect_url variable ?

Open the page index.php in your browser and you will be redirected to the Google Oauth site and when the user authorised your app they will reach the redirect_url you specified in index.php configuration section.

Where can I get the list of scopes ?

I have made a blog post containing the list of scopes. View the post @ http://sag-3.blogspot.com/2013/04/list-google-oauth-scopes.html

Show Comments