Forgot your password?

Home > About Us > Modern Signal Blog >Overview of Google+ Sign-In

Overview of Google+ Sign-In

In a previous post, I described my experience working with Facebook Login integration.  I recently implemented Google login integration (aka Google+ Sign-In), which is very similar to Facebook's integration.  This feature enables Google users to login to your site using their Google credentials.  As such, the user does not need to create and remember a username and password for your site.  Their Google credentials are used instead.

Here is the main page on Google's site regarding Google+ Sign-In: https://developers.google.com/+/web/signin/.  The majority of the information is very straight-forward. However, I will share a few pieces of code that pulled it all together for me.

Here is my signinCallback function code, which redirects the browser window upon successful Google login.  Note that the accessToken parameter is sent to our server for further processing. 

function signinCallback(authResult) {
    if (authResult['access_token']) {
       // Successfully authorized
       window.location = "/MyAccount/GoogleLogOn?returnURL=@(Request["returnURL"])&accessToken=" + authResult['access_token'];
    }
}

Here is my server-side C# code that uses the accessToken provided by Google to obtain the associated Google UserID.

string googleUserID = "";
using (var webClient = new System.Net.WebClient())
{
   var json = webClient.DownloadString("https://www.googleapis.com/plus/v1/people/me?access_token=" + accessToken);
   JObject o = JObject.Parse(json);
   googleUserID = (string)o["id"];
}

Once we have the associated Google UserID, we can poll our database and confirm that a user exists in it with this associated Google UserID.  If so, we can log the user in.

Testimonials

  • This was by far the smoothest website redevelopment I have ever experienced. Modern Signal was a wonderful company to work with and we greatly value our working relationship. 

    - National Association of Student Financial Aid Administrators

  • Modern Signal worked with us to understand our needs and figure out what solution would work best for us. Our Lighthouse CMS is perfectly suited to our website goals. When we later needed to modify the CMS, they again took the time to understand exactly what was  needed and then built that functionality rather than delivering a cookie cutter solution.   

    - Ecosystem Investment Partners

  • I felt as if my company was their only client. They responded to my needs quickly and efficiently despite short turn around time and intense demands.

    - Teaching Strategies, Inc.

  • We wouldn’t have gotten where we are today without your support over the years.  Modern Signal has always been a great partner to us.

    - Kirk Gillis, Managing Director at Zoom Tanzania

  • Modern Signal significantly enhanced our site to be more efficient and user-friendly. They provide excellent customer service with timely and cost-effective solutions.

    - Center for Medicare Education

  • Modern Signal understands our business - from future needs to current limitations - so their solutions are always scalable, solid, and service-oriented.

    - National Association of Home Builders

  • I love working with Modern Signal! Their CMS is very easy to use and they are incredibly responsive to questions or challenges I bring them.

    - NALP

  • Modern Signal has a professional staff that was very responsive to our needs during all phases - scoping, developing, implementing and maintaining - of our project.  We have been pleased with their ability to deliver quality work on time and on budget. If given the opportunity, I would work with them again.

    - The National Center for Safe Routes to School

  • Modern Signal has been a great partner for us for over the past 10 years.  As our business grew and our needs changed, Modern Signal was able to work with us to adjust our website platform in the ever-changing online world.  Their service and response level has been second to none, and we've been never been happier with our relationship with them.

    - Charm City Run