问题描述
问题:我在通过api调用获取用户生日方面遇到困难,并且对OAuth还是陌生的.
Problem : I am facing difficulties in getting user's birthday from api calls and I am new to OAuth.
已遵循的步骤 :(已遵循了使用google +实施登录所需的所有步骤)
1.创建了一个应用.
2.获得了app_id和secret_key.
3.不使用SDK,在php中没有SDK的情况下实现了该过程.
4.通过调用accounts[dot]google[dot]com/o/oauth2/auth?
获得"CODE"5.使用CURL
,使用HTTPS POST方法将请求访问令牌的URL参数的URL参数中的代码使用到https://accounts.google.com/o/oauth2/token
6.访问登录页面时,系统要求用户授予访问信息的权限,例如电子邮件,个人资料,DOB等,但我无法找到获取该生日的方法
7.我已经尝试访问www[dot]googleapis[dot]com/plus/v1/people/User_ID?key={THE_API_KEY}
.还是没有运气
Steps followed : (Have followed all steps required for implementing login with google+)
1. Created an app.
2. Obtained app_id and secret_key.
3. Did not make use of SDK, implemented the process without SDK in php.
4. Obtained "CODE" by calling accounts[dot]google[dot]com/o/oauth2/auth?
5. Using the code from the URL parameters requested for access token by HTTPS POST method to https://accounts.google.com/o/oauth2/token
, using CURL
6. When accessing the login page, user is asked for permissions to access the information such as email, profile, DOB etc., but I am not able to find a way to get that date of birth
7. I have tried access www[dot]googleapis[dot]com/plus/v1/people/User_ID?key={THE_API_KEY}
. Still no luck
请指导或建议我如何获得DOB.还请告诉我是否还有其他我想分享的信息.
Please guide or suggest me on how to get the DOB. Also let me know if there is any other information I missed to share.
谢谢.
干杯!法汉
推荐答案
当然很好..它必须是Google的安全措施.
Well Well Ofcourse.. It has to be a security thing from google.
我在不同情况下进行了一部分单元测试后就知道了,而错过了一个简单的事情,即如果用户允许在个人资料设置中使用google,Google只会以b'day信息作为响应.
I got to know after I did a part of unit testing with different scenarios and missed out on a simple thing that google only responds with the b'day information if the user has allowed to in his profile settings.
如果所有出生年份都被隐藏,则在HTTPS Post方法的响应中它将抛出0000作为年份.
all if the birth year is hidden, it will throw 0000 as year in the response of the HTTPS Post method.
如果我提供的任何信息有误,请纠正我.
If I am wrong in any of the information provided, Please do correct me.
干杯!法罕.
这篇关于从Google API调用中检索用户的生日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!