Skip to main content

Login with Google Account to Website using OAuth2.0 with PHP / Javascript



This post have Complete Code for Login / Sign-in  with google Account  using PHP / Javascript with oAuth2.0

Basically today we have seen almost every website needs you to register yourself before you can post or take part in any discussions to the website. But it become a tedious task to register and login to many different sites. Solution is to provide the users the option to Login with existing Google / Facebook account as almost everyone have Facebook and Google account.

In this post, I am going to explain how to integrate the Google Login / Sign in  for your website.

Download Source Code

Live Demo



For this,  First you need to create your Client ID, Client Secret and your developer API key.

For this go to https://code.google.com/apis/console/


Click on the button Create Project. A new window will open up like this :













Enter the Project name and submit on Create.

Wait for new seconds, the new page will open like this.
 


On the left menu, click on API & Auth and click on credentails. Then on center click on Add Credential , under that, click on oAuth 2.0 Client ID.
Select the type of Application and the application Information to get the credentials.
Add them in the code(mentioned in code, where it is to be added).

Thats it.

If you like the Post, please share on facebook and google.

Thanks,


Other related Posts:

Login with Facebook Account

Introduction to Natural Language Processing

ORCAM - Blind can read too.!!!

Introduction to JSON

You can also check our Microservices post

Introduction to Microservices




Comments

  1. If you like the post, please leave the comment.
    If i got good response, then very soon i will be do a post on "Login with Facebook" and others..

    ReplyDelete
  2. Great work!
    But not able to download src file and not able to view demo

    ReplyDelete
  3. @sujeet : please check again..
    I have checked and its working fine..

    If you any issue, let me know.

    ReplyDelete
  4. please see this: http://i.imgur.com/ZMp6llv.png

    ReplyDelete
  5. Sujeet you can download the code

    http://tinyurl.com/pra4xgq

    Still if you are unable, please mail me,,ii will reply with the code

    ReplyDelete
  6. i still cannot get the source files pls share the link

    ReplyDelete
  7. Link is also on the same server. Looks like u are having some firewall issues. I will upload the code on some different domain will give you the link;)

    ReplyDelete
  8. I cannot download the source code. Can please provide another download link?

    ReplyDelete
  9. Hi Ankit,

    Are you using the latest Google+ Sign in Api as mentioned in https://developers.google.com/+/api/auth-migration ?

    ReplyDelete
  10. It's just WORKED, amazing, 1000 thanks.

    I don't understand why/how google are writing their samples codes. It should be like this !

    Best regards

    ReplyDelete
  11. 400. That’s an error.

    Error: redirect_uri_mismatch

    Application: kolusu

    ReplyDelete
    Replies
    1. Please clear your browser cache and then try. I checked it just now, its working fine..

      Delete
  12. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    Web Designer Melbourne

    ReplyDelete
  13. Hi,
    I want to integrate Google Login for my website www.dailytenminutes.com
    Your tutorial is awesome however "download source code" link is not working... please help !!!

    ReplyDelete
  14. Fabulous blog on Web innovation.Have expanded more information related to webpage progression. Thank overseer for this brilliant substance.
    Article Submission sites | Latest Updates | Technology

    ReplyDelete
  15. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    White Label Website Builder

    ReplyDelete

Post a Comment

Popular posts from this blog

What is MonGoDB??

Share on Google Plus Now a Days, we are hearing a lot about MongoDB.

So, in this post I will try to briefly introduce to MongoDB.

MonGoDB is "Non-Relational, JSON, Document Store".

Explaining in detail,

Non-Relational, --> The DB we use most like SQl, Oracle are Relational DBs(RDBMS). They do have the fixed schemas, lots of tables. So Non-relational in nothing like that.

JSON : (JavaScript Object Notation) : It is basically a document with information in the form of key value pair.

for example,

{
   name:"lorem",
   address:"ipsum
}

thats it. 
A simple JSON document where name and address are key
and "lorem" and "ipsum" are corresponding values.

So, MongoDB is the Non Relational database which stores information using DOCUMENT and that document is a JSON document.

MongoDB stores collections of documents.
(Consider the above exxample as collection  "Person"  with a document)(will elaborate it later more)


Need of MongoDB:
The Databases we use…