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

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

问题描述

我正在尝试从 Google API 获取 birthday,但是 HWIOAuthBundle 中检索到的数据不包含它.

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

如果没有,请提供链接或更正的范围.

谷歌:类型:谷歌客户端 ID:%client_id%client_secret: %secret_id%范围:https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"路径:电子邮件:电子邮件个人资料图片:图片

解决方案

我刚刚使用并测试了它 试试.我用所有不同的范围对其进行了测试.

<块引用>

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年

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

People.get 但是我怀疑它与google+ 所以如果用户没有填写它你可能不会得到信息.

<块引用>

GET https://people.googleapis.com/v1/{资源名称=人/*}

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

<代码>{资源名称":人/117200475532672775346",etag":%EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ==",生日":[{元数据":{主要":真,来源":{类型":配置文件",id":117200475532672775346"}},日期":{月":1,天":6}},{元数据":{来源":{类型":帐户",id":117200475532672775346"}},日期":{年份":1971,月":1,天":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天全站免登陆