8

I'm trying to retrieve date of birth and marital status via Google OAuth api. I get below mentioned info by setting the scopes as https://www.googleapis.com/auth/userinfo.profile & https://www.googleapis.com/auth/userinfo.email . Request URL is https://www.googleapis.com/oauth2/v2/userinfo

{
 "id": "my_id",
 "email": "test@gmail.com",
 "verified_email": true,
 "name": "full_name",
 "given_name": "first_name",
 "family_name": "last_name",
 "link": "https://plus.google.com/xxxxxxx",
 "picture": "https://xxxxxxxxx/photo.jpg",
 "gender": "male",
 "locale": "en"
}

I have birthday and marital status set in my profile, but I'm unable to get this info. What could the problem be?

4

1 回答 1

10

将范围设置为

https://www.googleapis.com/auth/plus.login

请求网址是

https://www.googleapis.com/plus/v1/people/me

注意:-关系状态和生日只有在用户将它们设置为 public时才对您可用。

看看这个google api explorer

我已经尝试过使用grails oauth 插件并公开我的生日和关系状态,它给了我

[birthday:1988-04-02, ..., relationshipStatus:single, ...]

编辑................................................. ...................................

Q. New problem with email, I can't get it after changes

您可以设置多个范围,例如:

https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/plus.login

并提出两个请求,一个是生日和关系状态

https://www.googleapis.com/plus/v1/people/me

另一个用于电子邮件

https://www.googleapis.com/oauth2/v2/userinfo
于 2013-10-27T12:08:03.013 回答