I have created google api services app and verify that user.profile info scope is by default added.
Authentication, token and get the user info is working fine for me, however few fields are missing in get user info api response.
I am using below mentioned endpoints to communicate with google api.
- Authentication : https://accounts.google.com/o/oauth2/v2/auth
- Retrieving Token : https://accounts.google.com/o/oauth2/token
- Getting User Info : https://www.googleapis.com/oauth2/v2/userinfo?access_token=xxxxxxxxxx and https://www.googleapis.com/oauth2/v1/userinfo?access_token=xxxxxxxxxx
WebRequest request = WebRequest.Create(googleGetUrl + $"&access_token={accesstoken}");
request.Credentials = CredentialCache.DefaultCredentials;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream receiveStream = response.GetResponseStream())
{
using (StreamReader readStream = new StreamReader(receiveStream))
{
string responseFromServer = readStream.ReadToEnd();
return JsonConvert.DeserializeObject<GoogleUser>(responseFromServer);
}
}
}
I am getting the json response as mentioned below
{
id: "xxxxxxxxxxxxx",
email: "[email protected]",
verified_email: true,
picture: "https://validurl/photo.jpg",
hd: "getting value"
}
But what I want expect like below mentioned Json
{
id: "xxxxxxxxxxxxx",
email: "[email protected]",
verified_email: true,
picture: "https://validurl/photo.jpg",
hd: "getting value",
name: "some value",
family_name: "some value",
given_name: "some value"
}
scope configuration :
Please let me know if I have missed any configuration. Your help would be much appreciated.
Kind Regards, Mohsin