Google+ API不返回带有登录请求的个人资料名称 [英] Google+ api doesn't return profile name with login request

查看:47
本文介绍了Google+ API不返回带有登录请求的个人资料名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google文档此处明确指出

The google documentation HERE clearly says that

您不应将userinfo.profile或plus.me与[https://www.googleapis.com/auth/plus.login]范围结合使用,因为它们是隐式包含的,并且会为您的用户创建一个混乱的权限对话框

You should not request userinfo.profile or plus.me in combination with [https://www.googleapis.com/auth/plus.login] scope as they are implicitly included and would create a confusing permissions dialog for your user.

...但是,如果我不使用

... yet if I don't use

https://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/userinfo.profile以及https://www.googleapis.com/auth/plus.login,该api不会返回用户的电子邮件地址或名称.

https://www.googleapis.com/auth/userinfo.email and https://www.googleapis.com/auth/userinfo.profile along with https://www.googleapis.com/auth/plus.login the api will not return the user's email address or name.

如果我不应该同时使用userinfo范围和plus.login范围,该如何获取用户名和电子邮件地址?

If I'm not supposed to userinfo scope along with the plus.login scope how do I get the the user's name and email?

推荐答案

您需要userinfo.email来获取电子邮件地址,但是您应该能够在没有 的情况下请求,同时也请求userinfo.profile. plus.login应该使您可以访问"GET/plus/v1/people/{userid}"调用,该调用应至少返回以下字段/对象:

You need userinfo.email to get the email address, but you should be able to request that without also requesting userinfo.profile. plus.login should give you access to the "GET /plus/v1/people/{userid}" call which should return the following fields/objects (at a minimum):

  • name-包含名称的对象,该名称分为多个字段
  • displayName
  • 昵称

这篇关于Google+ API不返回带有登录请求的个人资料名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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