为什么Google+ API不会返回性别?

时间:2012-09-19 03:17:17

标签: google-plus social-networking google-api-client

我正在使用这些测试:

https://developers.google.com/+/api/latest/people/get

https://developers.google.com/apis-explorer/#p/plus/v1/plus.people.get

即使它们是公开可见的,它们也都不会返回用户性别。

我也尝试过启用OAuth 2.0,但仍然没有运气。

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

此信息可从/oauth2/v1/userinfo API获得。

您需要包含OAuth 2.0范围:https://www.googleapis.com/auth/userinfo.profile

可以从端点获取信息: https://www.googleapis.com/oauth2/v1/userinfo?access_token={accessToken}

官方文件: https://developers.google.com/accounts/docs/OAuth2Login#userinfocall

API Explorer: https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.userinfo.get

答案 1 :(得分:1)

如果您查看:https://developers.google.com/apis-explorer/#p/plus/v1/plus.people.get?userId=114452557602978803926&_h=1&,您会看到可以使用people.get()为公开该信息的任何用户检索性别。