使用Google OAuth API检索出生日期和婚姻状况 [英] Retrieving date of birth and marital status with Google OAuth API

查看:682
本文介绍了使用Google OAuth API检索出生日期和婚姻状况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过Google OAuth api检索出生日期和婚姻状态。我通过将范围设置为 https://www.googleapis.com/auth/userinfo .profile & https://www.googleapis.com/auth/userinfo.email 。请求网址为 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
}

和婚姻状况设置在我的个人资料中,但我无法获取此信息。请帮助我了解问题所在。 pre> https://www.googleapis.com/auth/plus.login

和请求网址

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

注意: - 只有您可以使用关系状态和生日如果用户将其设为公开



查看此 google api explorer



我已经使用 grails oauth plugin ,让我的生日和关系状态公开给我

  [生日:1988-04-02,...,relationshipStatus:single,...] 

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

  Q。电子邮件的新问题,我改变后无法获得

您可以设置多个范围:

  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 


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. Please help me to understand what's the problem.

解决方案

Set scope to

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

and request url is

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

NOTE:- Relationship Status and Birthday only available to you if user set them public.

Have a look to this google api explorer.

I have tried this using grails oauth plugin and make my birthday and relationship status public it gives me

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

EDIT.................................................................................

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

You can set multiple scopes like:

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

and make two requests one for birthday and relationship status

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

and another for email

https://www.googleapis.com/oauth2/v2/userinfo

这篇关于使用Google OAuth API检索出生日期和婚姻状况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆