How to get user profile using Google Access Token

google apigoogle-oauthsigning

i'm testing getting user information by google access token

http://www.mawk3y.net/glogin

after clicking sign in button i get redirected to

https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=access_token_here

And get some JSON data like this

{
"issued_to": "my client id.apps.googleusercontent.com",
"audience": "my client id.apps.googleusercontent.com",
"user_id": "user id here",
"scope": "https://www.googleapis.com/auth/plus.login",
"expires_in": 3596,
"access_type": "online"
}

now i need to know how to extract user name , address and email any help please ?

thanks in advance

Best Answer

Try this one:

 var url = 'https://www.googleapis.com/plus/v1/people/me?access_token={access_token}';

  $.ajax({
    type: 'GET',
    url: url,
    async: false,
    success: function(userInfo) {
      //info about user
      console.log(userInfo);
      console.log('test');
    },
    error: function(e) {
      console.log('error');

    }
  });
Related Topic