我正试图通过Google OAuth api检索出生日期和婚姻状况.我得到低于设定范围,有提到信息 https://www.googleapis.com/auth/userinfo.profile&https://www.googleapis.com/auth/userinfo.email.请求网址为https://www.googleapis.com/oauth2/v2/userinfo
{
"id": "my_id",
"email": "test@gmail.com",
"verified_email": true,
"name": "full_name",
"given_name": "first_name",
"family_name": "last_name",
"link": "https://plus.google.com/xxxxxxx",
"picture": "https://xxxxxxxxx/photo.jpg",
"gender": "male",
"locale": "en"
}
Run Code Online (Sandbox Code Playgroud)
我的个人资料中设有生日和婚姻状况,但我无法获得此信息.请帮我理解是什么问题.
我使用从最近发布的谷歌的人API的例子在这里.我稍微扩展了一些示例,以显示有关联系人的其他信息,例如电子邮件地址和电话号码.应该完成这项工作的代码如下所示.
public class PeopleQuickstart {
...
public static void getPersonInfo(Person person){
// Get names
List<Name> names = person.getNames();
if(names != null && names.size() > 0) {
for(Name personName: names) {
System.out.println("Name: " + personName.getDisplayName());
}
}
// Get email addresses
List<EmailAddress> emails = person.getEmailAddresses();
if(emails != null && emails.size() > 0) {
for(EmailAddress personEmail: emails) {
System.out.println("Email: " + personEmail.getValue());
}
}
// Get phone numbers
List<PhoneNumber> phones = person.getPhoneNumbers();
if(phones != null && phones.size() > 0) { …Run Code Online (Sandbox Code Playgroud) 我正在使用 Google People API 从 Node JS 客户端获取用户帐户信息(仅适用于使用 Gmail API 通过 gmail 登录授权的用户)。我想确保我使用的 people.get 方法不会受到关闭 Google+ 及其 API 的影响。
这是谷歌于 2018 年 12 月 20 日发送的通知开发人员关闭的电子邮件的摘录:
"注意:如果您看到对 people.get 的调用,这可能是在您的应用程序中使用 Google+ 登录功能的结果,该功能现已完全弃用并正在关闭。开发人员应从 Google+ 登录功能迁移到更全面的 Google 登录身份验证系统。”
如上所述,我使用 People API 来调用 people.get,但我不清楚这是否会受到 Google+ 弃用的影响。