【发布时间】:2012-06-01 11:09:46
【问题描述】:
有人知道如何通过 Google OAuth api 检索 DOB 吗?我可以通过将范围设置为https://www.googleapis.com/auth/userinfo.profile 来获取其他信息,例如姓名、电子邮件、性别。但是我无法在这个范围内获得 D.O.B。
【问题讨论】:
有人知道如何通过 Google OAuth api 检索 DOB 吗?我可以通过将范围设置为https://www.googleapis.com/auth/userinfo.profile 来获取其他信息,例如姓名、电子邮件、性别。但是我无法在这个范围内获得 D.O.B。
【问题讨论】:
我肯定会为我的帐户获得它:
{
"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
【讨论】:
看来你必须发送 2 个请求:
获取 google plus 个人资料数据和 google 帐户数据(如果需要,还有生日日期和区域设置)
我使用抄写员,它工作正常。设置两个范围(“https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.me”)并为两个 REST 链接发送两个请求
【讨论】: