2017-09-13 27 views
1

GPPSignIn *signIn;获取Google的个人配置文件API不返回出生日期和性别键值

在我的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; 

,并试图从Google获得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是有许多属性,但不是出生日期和性别。

任何人有什么想法?请建议。提前致谢。

欢呼声中,拉胡尔

+0

更新:新创建的帐户没有这些属性,但我测试创建一年和4年前的帐户,谷歌apis返回这两个领域,怪异吧? –

回答

0

有可能的问题是,如果字段已被设置为具有公共知名度的出生日期和性别只能返回。隐私可见性字段将不会被返回。

如果你使用谷歌人民API这比G +人们API不同,你应该能够得到私人生日https://www.googleapis.com/auth/user.birthday.read范围。不幸的是,性别没有私人空间。

有关详细信息,请参阅https://developers.google.com/people/上的Google People API文档。

+0

我已经在我的Google帐户设置中公开了生日和性别。所以,我不认为这是问题。我想,这是因为我在我的问题的评论中提到的原因。 –

相关问题