Get your Google account information after logging into my site using google login (Use satellite to log in)

I used satellizer and node server to login to my site using google.

I successfully registered and added the data to the 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 my google account, such as "Gender", "Phone Number", "Location, etc.".

So how to get all login user information from google account?

+5
source share
2 answers

Not all of this information is really available. It will also depend on whether the user has provided information to the public or not.

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

There is also a People API, which typically returns similar information to people.get . I donโ€™t know exactly where this information comes from. This seems to be related to a Google user account, not a Google+ account.

+1
source

I finally succeeded, 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); }); 
+1
source

All Articles