简体   繁体   English

Google+ API人员列表未返回任何内容

[英]Google+ API People List return nothing

i am developing a class library for a web server and used Google+ API to get information from my G+ profile. 我正在为网络服务器开发类库,并使用Google+ API从我的G +个人资料中获取信息。

For authentification i use https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth (Service account). 为了进行身份验证,我使用https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth (服务帐户)。

When i query myPlusService.People.List("myGoogle+Id",PeopleResource.ListRequest.CollectionEnum.Visible).execute(); 当我查询myPlusService.People.List("myGoogle+Id",PeopleResource.ListRequest.CollectionEnum.Visible).execute();

it delivers empty result, even though there are some when i use this platform: https://developers.google.com/+/api/latest/people/list 它提供了空的结果,即使当我使用此平台时也有一些结果: https : //developers.google.com/+/api/latest/people/list

Is the problem lies in Credentials? 问题出在凭证上吗? If yes, which method should i use? 如果是,我应该使用哪种方法? Thank you. 谢谢。

A few points: 几点:

  1. Make sure you're requesting the https://www.googleapis.com/auth/plus.login scope 确保您请求的是https://www.googleapis.com/auth/plus.login范围
  2. You must authorize the user. 您必须授权用户。 Simply using the developer API key is not enough 仅使用开发人员API密钥是不够的

If you are doing those two things, you should check your access token using OAuth 2 token verification . 如果您要执行上述两项操作,则应使用OAuth 2令牌验证来检查访问令牌。

The people made visible to your app are in the control of the user. 对您的应用可见的人员在用户的控制之下。 If the user does not make people in their circles visible, you will get empty API responses, which may be why the list is empty. 如果用户未显示圈子中的其他人,您将获得空的API响应,这可能是列表为空的原因。 When you see the OAuth dialog, make sure to select the people you want to make visible to the app and see if that helps. 当您看到OAuth对话框时,请确保选择要在应用程序中看到的人,看看是否有帮助。 If you aren't prompted to select people to make visible, you are requesting the incorrect scope. 如果未提示您选择要公开的人,则说明您请求的范围不正确。

I was having the same problem, maybe the solution is the same. 我遇到了同样的问题,也许解决方法是相同的。 In my case the problem is that, even if the user was granting me plus.login, he still has to say circles that your app can see. 就我而言,问题是,即使用户授予我plus.login,他仍然必须说出您的应用可以看到的圈子。 This can be done in 2 ways: 这可以通过两种方式完成:

  • in the dialog, after there is a link saying something like "Edit list". 在对话框中,后面有一个链接,上面写着“编辑列表”之类的内容。 Once there you can add those dialogs that you want your app to be able to see. 在那里,您可以添加希望应用程序能够看到的对话框。
  • in the application management you can select "Advanced connection settings" and add those circles. 在应用程序管理中,您可以选择“高级连接设置”并添加这些圈子。

This worked for me. 这对我有用。 However, I am still searching for a way of doing this directly since it appears the default dialog doesn't add this "permissions to see those circles". 但是,我仍在寻找直接执行此操作的方法,因为默认对话框似乎没有添加此“查看这些圈子的权限”。 Which is ironic because if you open the list they are all selected by default. 具有讽刺意味的是,如果您打开列表,则默认情况下将其全部选中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM