Skip to main content

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

Login with Google Account using PHP with code


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.



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

For this go to https://developers.google.com/identity/sign-in/web/sign-in




Click on the button Create Project. A new window will open up. Please select Create Project / or select already created Project.

It will then ask for about type of Project. Please select Web-browser. Then it will ask for url of page on which login button will appear. Enter the url.



Once, you do this, you will get the credentials. Download the credentials file(credentials.json) file.

Now write CODE :


You can simply pass the information you get in java-script function to the Backend.

Thats it.

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

Thanks,



Other related Posts:

Login with Facebook Account

How to setup virtual Host in Ubuntu

Introduction to Natural Language Processing

ORCAM - Blind can read too.!!!

Introduction to JSON

You can also check our Microservices post

Introduction to Microservices

Spring boot Profiles : Different config for different environment


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
  16. I am happy to find this post Very useful for me, as it contains lot of information

    opencu
    Article submission sites

    ReplyDelete
  17. This is genuinely an awesome read for me. I have bookmarked it and I am anticipating perusing new articles. Keep doing awesome!
    white label website builder

    ReplyDelete
  18. Great post! This is very useful for me and gain more information, Thanks for sharing with us.

    Guest posting sites
    Education

    ReplyDelete
  19. Thanks for sharing information with us. If someone wants to know about web design and seo, I think this is the right place for you!
    web design company in coimbatore
    seo company in coimbatore

    ReplyDelete
  20. This is a very amazing post for cheap web hosting services. in this post, you have provided all the basic information regarding.

    website builder for reseller

    ReplyDelete
  21. I am really enjoying reading your well written articles.
    It looks like you spend a lot of effort and time on your blog.
    I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
    PHP Training in Chennai
    PHP Course in Chennai
    Angularjs Training in Chennai
    CCNA Training in Chennai
    ui design course in chennai
    Salesforce Training in Chennai
    web designing training in chennai
    Tally Course in Chennai

    ReplyDelete
  22. awesome blog it's very nice and useful i got many more information it's really nice i like your blog styleweb design company in velacheryweb design company in chennai

    ReplyDelete
  23. NICE BLOG!!! Your blog is very informative for us. I would really like to come back again right here for likewise good articles or blog posts. Thanks for sharing a nice information...
    Web Design Company in Bangalore | Web Development Company in Bangalore | Advertising Agencies in Bangalore | SEO Company in Bangalore | Digital Marketing Companies in Bangalore | Ecommerce Website Development in Bangalore

    ReplyDelete
  24. The article was up to the point and described the information very effectively. Thanks to blog author for wonderful and informative post.
    website designing

    ReplyDelete
  25. The information that you have shared is really useful for everyone. If someone wants to know about EHS Software and Occupational Safety Softwares I think this is the right place for you.

    ReplyDelete

Post a Comment

Popular posts from this blog

Login with Facebook Account PHP Code

Hello All.

In the previous post, we have explained the Login with Google..


This post have Complete Code for Login / Sign In with Facebook Account for PHP Code
As you all know, FB is as popular as Google, so Login With Facebook is also a very important par of a website,

Below is the detailed explanation for complete procedure starting from creating  a  Facebook app to getting the complete details of user logged in .


Download Source Code

Live Demo


Starting is with create an APP for your site .

Note : You should log in to your Facebook account before moving ahead.

Go To https://developers.facebook.com/

Create an APP using the menu  APP appearing on developers toolbar on this page

The Following popup appears


 Fill in the details and CREATE APP

After this the APP dashboard appears .

The dashboard has the App Id




Though the app id is the only required field for login , in backend the process the URLs ie the domain url assigned to APP and that of the Facebook login invoking page .
So next step…

TCP Chat Server in Node.js

d.Hello all.

Today in this post, I am going to explain about how to use a "net" module in node.js and build a basic chat server.(i.e a TCP chat server)

For this, you need to use either telnet / netcat(nc).(I have tried it on netcat, simply google "netcat download")
(Dont worry about the script for now, i will upload it, just go through the tutorial to understand the concept)

So, lets begin,

first of all to use node "net" module , we need to import it in out script.

var net = require("net")

This will import the net module. Now moving ahead, we need to create a server. This is done by createServer  function(on simply Server function).

var server = net.createServer()

createServer has a callback whenever a client connects to a server.

i.e
var server = net.createServer(function(socket){

});

The code inside the createServer() function is callback(Hope you have know about the callbacks / event driven programming). This gets called whenever, a client gets c…