5

I have used satellizer and node server for login in my website with google sing in.

I have successfully login and following data added in mongodb database.

{
    "_id" : ObjectId("57adec45a8fb51401c1ba843"),
    "displayName" : "xyz user",
    "picture" : "https://lh3.googleusercontent.com/-xxxxxxx_xx/xxxxxx/xxxxxxx/xxxxxxx/photo.jpg?sz=200",
    "google" : "100379763204xxxxxxxxx", //user id
    "__v" : 0
} 

Now, I want to get other information from google account like Gender, Phone Number, Location etc...

So, How to get all information of login user from google account?

Mehul Mali
  • 3,084
  • 4
  • 14
  • 28
  • i think this has already been answered here .. http://stackoverflow.com/questions/33892546/how-can-i-get-profile-like-gender-from-google-signin-in-android – user641887 Aug 14 '16 at 07:45

2 Answers2

1

Not all of that information is actually available. It will also depend upon if the user has set the information to public or not.

If you use the People: get method it will return a person resource Resource. Assuming the user has this information public you should see the information you are after. This method is part of the Google+ api so it will only work if the user has a Google+ account.

There is also the People API which tends to return similar information people.get. I am not sure exactly were this information is coming from. It appears to be related to a users Google account as opposed to the Google+ account.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
1

I finally success , there is my solution :

getGoogleDatas: function (id) {
    return $http.get("https://www.googleapis.com/oauth2/v1/userinfo", {
        params: {
            access_token: $auth.getToken(),
            alt: 'json'
        }
    });
}

and then :

getGoogleDatas().then(function (response) {
    user = response;
}).catch(function (error) {
    console.log('error:', error);
});
Dan M. CISSOKHO
  • 1,070
  • 1
  • 12
  • 27