无法使用 google plus API 进行授权
我正在尝试使用 google plus 授权我的应用程序。然而,当我使用人员服务并尝试获取“我”时,我尝试过的所有操作总是给出 404,除非我使用创建 Google+ API 应用程序的用户登录。对于我为什么会出现这种情况没有任何意义。
from httplib2 import Http
from apiclient.discovery import build
credential = gp_client.step2_exchange(request.REQUEST)
http = Http()
http = credential.authorize(http)
service = build("plus", "v1", http=http)
o = service.people().get(userId='me').execute()
当我使用 Google+ 浏览器时也是如此:
http://code.google.com/apis/explorer/#_s=plus&_v=v1&_m=people.get&fields=emails
如果我切换到与用户不公开谁创建了 API,那么我可以获取“我”,但如果我授权其他用户,那么我无法获取“我”。
有什么想法吗?
I am trying to authorize my app using google plus. However, everything I've tried always gives me a 404 when I use the people service and attempt to get 'me', except when I log in with the user who created the Google+ API app. It doesn't make any sense to my why that would be the case.
from httplib2 import Http
from apiclient.discovery import build
credential = gp_client.step2_exchange(request.REQUEST)
http = Http()
http = credential.authorize(http)
service = build("plus", "v1", http=http)
o = service.people().get(userId='me').execute()
The same is also true when I use the Google+ explorer:
http://code.google.com/apis/explorer/#_s=plus&_v=v1&_m=people.get&fields=emails
If I switch to private with the user who created the API, then I can fetch 'me', but if I authorize another user, then I can't fetch 'me'.
Any ideas what is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
终于明白这是什么了。 Google 允许您为应用程序授权任何 Google 帐户。但是,如果授权用户尚未升级到 Google+,则当应用程序发出第一个 Google+ API 请求时,该请求将出现 404。这令人难以置信,因为当我设置 OAuth2WebServerFlow 时,我指定了“plus.me”作为范围。 ..恕我直言,当用户尝试授权此 OAuth 请求时,Google 应该告诉用户升级到 Google+。
Finally figured out what this was. Google lets you authorize any google account for an app. However, if the authorizing user hasn't upgraded to Google+, when the app makes its first Google+ API request, the request will 404. This is mind boggling, because when I setup the OAuth2WebServerFlow I specified "plus.me" as the scope... IMHO Google should tell the user to upgrade to Google+ when they try to authorize this OAuth request.