Game Changing Mobility

It is increasingly becoming impossible to remember the username and password of every single application one uses. Google+ Sign In is an effective and easy way to overcome this problem.

How to do it?

The simplicity to implement and the security of theGoogle+ Sign In makes it very popular. Whether the application is a web, mobile or desktop version, Google provides the APIs and sdks which are quite easy to master and implement:

Here we can see how to implement Google+ Sign In in a web application using wcf service.

First of all, we need a client ID and client Scecret which provides the google itself.

5. redirect url:- the page will be redirected to this url after successful login. this redirect url should be same as given in the google’s console account (developers account)

6. _url:- the complete form of the authentication url (1+3+4+5)

Here we open the _url in a new window then it loads a Google plus login page on this new window.On login submission google send back the access token along with the redirect url which we have given earlier. From this redirect url we will get the access token for that specific user.

Sample Code:

The below sample code shows how to get the access token from the return url and to check whether the access token is valid or expired.

Sample Code:

If the access token is valid we can call another api to get the desired user details from google. Here we pass the access token as query string along with the api url. It returns the user details as json object in its response.

Sample Code:

For more security we can call the above method by using wcf service.In this case, we call the service using ajax call and pass the access token to the wcf service.In the wcf service we use the same api url to get the user info as used in the above method. It returns the details of users like email,google Accountid,etc.This email id and google accountId are used in our application to manage the login statuses.