如何指定Google API的范围来获得生日 [英] How to specify the scope of Google API to get the birthday

查看:150
本文介绍了如何指定Google API的范围来获得生日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Google API获取生日,但是 HWIOAuthBundle 中的检索数据不包含它。



我想知道config.yml中的 google plus api 的指定范围是否正确!

如果不是,请给出一个链接或更正后的范围。

  google:
类型:google
client_id:%client_id%
client_secret:%secret_id%
范围:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile
路径:
电子邮件:电子邮件
profilepicture:图片


解决方案

我刚刚使用试试看。我测试了所有不同的范围。


https://www.googleapis.com/auth/plus.login 了解您的基本资料
信息以及您圈子中的人员列表。



https://www.googleapis.com/auth /plus.me 了解您在Google上的身份
https:// www.googleapis.com/auth/userinfo.email 查看您的电子邮件地址
https://www.googleapis.com/auth/userinfo.profile 查看有关您帐户的基本
信息


在所有范围内,你都没有回到生日那么重要。但重要的是,帐户中的用户生日必须设置为 public 。如果它被设置为其他任何内容,您的圈子,只有你,它没有列出。即使您试图查看自己的信息,这似乎也是如此。 (发送我。)



更新和年份为2018年



api现在返回当前用户的生日



People.get 但是我怀疑它与google +链接,所以如果用户没有填写您可能不会获得信息。


GET https://people.googleapis.com/v1/ {resourceName = people / *}


发送资料名称 people / me 和生日 personFields

  {
的资源名称: 人/ 117200475532672775346,
的etag: %EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ ==,
生日:[
{
metadata:{
primary:true,
源:{
type:PROFILE,
id:117200475532672775346
}
},
date:{
month:1,
day:6
}
},
{
metadata:{
source: {
type:ACCOUNT,
id:117200475532672775346
}
},
date:{
year :1971,
month:1,
day:6
}
}
]


I am trying to get the birthday from the Google API, but the retrieved data in HWIOAuthBundle do not contain it.

I am wondering if the specified scope for google plus api in config.yml is correct or not!

If not, please give a link or the corrected scope.

google:
    type:                google
    client_id:           %client_id%
    client_secret:       %secret_id%
    scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
    paths:
        email:           email
        profilepicture:  picture

解决方案

I just used and tested it using Try It. I tested it with all of the different scopes.

https://www.googleapis.com/auth/plus.login Know your basic profile info and list of people in your circles.

https://www.googleapis.com/auth/plus.me Know who you are on Google https://www.googleapis.com/auth/userinfo.email View your email address https://www.googleapis.com/auth/userinfo.profile View basic information about your account

It doesn't appear to matter you get back the birthday in all of the scopes. But what does matter is that the Users Birthday must be set to public in the Account. If it's set to anything else, your circles, only you, it's not listed. This appears to be true even when you are trying to see your own information. (Sending Me.)

Update and the year is 2018

The People api now returns the birthday of the current user

People.get However i suspect its linked to google+ so if the user hasn't filled it out you probably wont get info.

GET https://people.googleapis.com/v1/{resourceName=people/*}

Send Resournce name of people/me and birthdays personFields

{
  "resourceName": "people/117200475532672775346",
  "etag": "%EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ==",
  "birthdays": [
    {
      "metadata": {
        "primary": true,
        "source": {
          "type": "PROFILE",
          "id": "117200475532672775346"
        }
      },
      "date": {
        "month": 1,
        "day": 6
      }
    },
    {
      "metadata": {
        "source": {
          "type": "ACCOUNT",
          "id": "117200475532672775346"
        }
      },
      "date": {
        "year": 1971,
        "month": 1,
        "day": 6
      }
    }
  ]

这篇关于如何指定Google API的范围来获得生日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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