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?
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.
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);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With