GPPSignIn *signIn;
在我的iOS应用中,我将范围设置为:
signIn.scopes = @[@"https://www.googleapis.com/auth/plus.login",
@"https://www.googleapis.com/auth/plus.me",
@"https://www.googleapis.com/auth/plus.profile.emails.read",
@"email",
@"profile",
@"https://www.googleapis.com/auth/user.birthday.read"];
也,
signIn.shouldFetchGoogleUserEmail = YES;
signIn.shouldFetchGooglePlusUser = YES;
并试图access_token
从谷歌获得。我得到并发送到服务器。
现在,我的服务器正在执行此操作:
client = OAuth2::Client.new('app_id', 'app_secret')
access_token = OAuth2::AccessToken.new(client, access_token)
profile_api_url = 'https://www.googleapis.com/plus/v1/people/me'
response = access_token.get(profile_api_url)
google_profile_res_body = JSON.parse(response.body)
在这里,google_profile_res_body
具有许多属性,但没有生日和性别。
有人知道吗 请提出建议。提前致谢。
干杯,拉胡尔
可能的问题是,仅当字段设置为具有公共可见性时,才返回生日和性别。私人可见性字段不会返回。
如果您使用的Google People API与G + People API不同,则应该能够获得带有https://www.googleapis.com/auth/user.birthday.read
范围的私人生日。不幸的是,没有性别的私有范围。
有关更多信息,请参阅https://developers.google.com/people/上的Google People API文档。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句