无法使用 - auth / user.phonenumbers.read范围从用户的Google个人资料中读取电话号码 [英] Can't read phone numbers from user's google profile using - auth/user.phonenumbers.read scope

查看:252
本文介绍了无法使用 - auth / user.phonenumbers.read范围从用户的Google个人资料中读取电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 Google People API 我正在使用配置文件范围 - https://www.googleapis.com/ auth / user.phonenumbers.read PersonFields = phoneNumbers ,只能在Google个人资料中读取经过身份验证的用户的电话号码(没有任何来自联系人列表)。我正在使用API​​密钥和oAuth accesstoken来授权请求​​。 Google人员API不会仅通过上述范围提取与配置文件关联的电话号码。除了> www.googleapis.com/auth/contacts.readonly 上述范围之外,为整个联系人列表读取权限添加范围将返回来自个人资料正确。是否有任何方法仅使用 user.phonenumbers.read范围从他/她的个人资料获取用户的电话号码?

Based on the documentation of Google People API I am using profile scope - https://www.googleapis.com/auth/user.phonenumbers.read and PersonFields=phoneNumbers to read the authenticated user's phone numbers only in their Google profile (none from the contact list). I am using API key and oAuth accesstoken to authorise the request. The google people API is not fetching the phone numbers associated with the profile with the above scope alone. Adding the scope for the entire contact list read access in addition to the above scope, which is www.googleapis.com/auth/contacts.readonly returns the phone numbers from the profile correctly. Is there any way to get user's phone numbers from his/her profile using only the user.phonenumbers.read scope?

推荐答案

我可以找出问题所在。对于'user.phonenumbers.read'作用域API人员状态的文档 - '您的应用程序可以在其 Google个人资料'中读取已认证用户的电话号码。

I could figure out the problem. For 'user.phonenumbers.read' scope the documentation of people API states - 'your app be given read access to the authenticated user's phone numbers in their Google profile'.

但通过 Google个人资料,它表示 Google Plus个人资料 完全不同,构成其核心Google个人资料 - 我的账户。 People API仅从Google Plus配置文件获取信息。

But by 'Google profile' it indicates the Google Plus Profile which is completely different form their core google profile - My Account. People API is fetching information only from the Google Plus Profile.

因此,即使用户在我的帐户中添加了他/她的联系详情, People API不会获取他们的电话号码,除非他们已经在他们的Google Plus配置文件中手动添加了他们的电话号码。添加联系人详细信息后,我可以使用'auth / user.phonenumbers.read'获取联系人详细信息,而无需添加'auth / contacts.readonly'作用域。

So even if a user has his/her contact details added in My Account, the People API will not fetch their phone numbers unless they have added them manually in their Google Plus Profile. After adding the contact details I could fetch contact details with 'auth/user.phonenumbers.read' without the need of adding 'auth/contacts.readonly' scope.

这篇关于无法使用 - auth / user.phonenumbers.read范围从用户的Google个人资料中读取电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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