如何使用谷歌+ API来获取朋友的电子邮件? [英] How to get Email of friend using google+ api?

查看:439
本文介绍了如何使用谷歌+ API来获取朋友的电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

林创建一个应用程序在Google+中登录并得到朋友的电子邮件。
林成功地进行身份验证并获得令牌回来,但是当我获取好友列表,用户类的任何一个朋友有电子邮件= NULL ...

Im creating an application to login in Google+ and get friends emails. Im authenticating succesfully and get token back , but when i fetch friends list , the user class of any single friends has emails=null...

在这里代码(后已签署,并获得认证类):

here is the code (After already signed in and get authenticator class):

// 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..

任何帮助吗?

推荐答案

借助Google+ API,只返回公共信息。所以,即使被允许看到一个人的电子邮件地址,这并不一定意味着信息是公开的,它会被退回。

The Google+ API only returns public information. So even if you are permitted to see a person's email address, it does not necessarily mean that the information is public and that it will be returned.

此外,在文档 https://developers.google.com/+/api/latest/people /列表只能保证人们的列表中返回将包含人的

Furthermore, the documentation at https://developers.google.com/+/api/latest/people/list only guarantees that the list of people returned will contain the person's


  • 标识

  • 显示名

  • 图片

  • 网址

  • id
  • displayName
  • image
  • url

并获得关于该人的其他信息,你需要做一个 people.get 针对该ID。但是,再一次请注意,如果这些信息是不公开的,你可能仍然无法获得他们的电子邮件。

and that to get other information about the person, you will need to do a people.get against that ID. But, again, note that you may still not get their email if that information isn't public.

这篇关于如何使用谷歌+ API来获取朋友的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆