【问题标题】:Retrieving date of birth with Google OAuth API使用 Google OAuth API 检索出生日期
【发布时间】:2012-06-01 11:09:46
【问题描述】:

有人知道如何通过 Google OAuth api 检索 DOB 吗?我可以通过将范围设置为https://www.googleapis.com/auth/userinfo.profile 来获取其他信息,例如姓名、电子邮件、性别。但是我无法在这个范围内获得 D.O.B。

【问题讨论】:

    标签: ios oauth-2.0 date


    【解决方案1】:

    我肯定会为我的帐户获得它:

    {
      "id": "108635752367054807758",
      "name": "Nicolas Garnier",
      "given_name": "Nicolas",
      "family_name": "Garnier",
      "link": "https://plus.google.com/108635752367054807758",
      "picture": "https://lh4.googleusercontent.com/-K1xGP8W20xk/AAAAAAAAAAI/AAAAAAAABhY/Cs_4qr30MxI/photo.jpg",
      "gender": "male",
      "birthday": "0000-08-25",
      "locale": "en"
    }
    

    我所做的只是授权https://www.googleapis.com/auth/userinfo.profile范围,然后向https://www.googleapis.com/oauth2/v2/userinfo发送一个GET请求

    首先确保您正在测试的 Google+ 帐户设置了生日(当然),然后在 OAuth 2.0 Playground 上尝试请求,例如:https://code.google.com/oauthplayground/#step1&apisSelect=https%3A//www.googleapis.com/auth/userinfo.profile&url=https%3A//www.googleapis.com/oauth2/v2/userinfo

    【讨论】:

    • :-> 感谢您的回复,尽管我后来发现了这一点:-> 谷歌的酷功能:D
    • 如果账户有生日并且在查询中没有?
    • 不幸的是,随着 Google+ 的弃用,这似乎消失了。 ://
    【解决方案2】:

    看来你必须发送 2 个请求:

    获取 google plus 个人资料数据和 google 帐户数据(如果需要,还有生日日期和区域设置)

    我使用抄写员,它工作正常。设置两个范围(“https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me”)并为两个 REST 链接发送两个请求

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-05
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 2014-04-22
      • 1970-01-01
      相关资源
      最近更新 更多