我创建了一个登录Google+的应用程序并收到朋友的电子邮件.我成功验证并获得令牌,但当我获取朋友列表时,任何一个朋友的用户类都有电子邮件= null ...
这是代码(已登录并获取authenticator类后):
// Generated libraries for Google APIs
using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Services;
using Google.Apis.Util;
using Google.Apis.Plus.v1;
using Google.Apis.Plus.v1.Data;
// For OAuth2
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth2;
//....code for authentication skipped ....
//...callback from json (authentication success)
PlusService ps = new PlusService(new BaseClientService.Initializer()
{
Authenticator = authenticator
});
PeopleFeed peopleFeed = ps.People.List("me", PeopleResource.CollectionEnum.Visible).Fetch();
//After that when i inspect peopleFeed[0].Emails <--- this is null..
Run Code Online (Sandbox Code Playgroud)
任何帮助?
Google+ API仅返回公开信息.因此,即使您被允许查看某人的电子邮件地址,也不一定意味着该信息是公开的并且将被退回.
此外,https://developers.google.com/+/api/latest/people/list上的文档仅保证返回的人员列表将包含该人员的
要获得有关此人的其他信息,您需要people.get针对该ID进行操作.但是,请注意,如果该信息不公开,您可能仍然无法收到他们的电子邮件.