【问题标题】:How to specify the scope of Google API to get the birthday如何指定 Google API 的范围以获取生日
【发布时间】:2014-07-16 18:42:50
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: symfony google-api google-plus google-oauth hwioauthbundle


    【解决方案1】:

    我刚刚使用并使用Try It 对其进行了测试。我用所有不同的范围对其进行了测试。

    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+ 相关联,所以如果用户没有填写它,你可能不会得到信息。

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

    发送people/me 和生日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
          }
        }
      ]
    

    【讨论】:

    • 简直完美!谢谢!
    • @DalmTo :- 你能指导我如何在 iOS 中使用 Google People API,我在 Google 网站上找不到任何文档或示例代码
    • google-api-objectivec-client 搜索例子,让这个工作drive sample 然后你应该能够为人们调整它
    • @DastanAlybaev 我更新了几年前移动的链接 people api。在尝试我时,只需更改单击显示范围,您就可以选择您已授权的范围。
    【解决方案2】:

    通常,您只会获得公开可见的生日。要获得私人生日,您需要使用 https://www.googleapis.com/auth/user.birthday.read 范围。请参阅文档,了解哪些范围为您提​​供哪些数据https://developers.google.com/people/v1/how-tos/authorizing#profile-scopes

    【讨论】:

      猜你喜欢
      • 2017-08-11
      • 2021-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-20
      • 1970-01-01
      • 1970-01-01
      • 2011-03-02
      相关资源
      最近更新 更多