【发布时间】:2013-08-02 03:04:18
【问题描述】:
在我的 iPhone 应用程序中,我使用Oauth2 使用谷歌登录,我正在关注this insturction 并成功登录
- (void)viewController:(GTMOAuth2ViewControllerTouch * )viewController
finishedWithAuth:(GTMOAuth2Authentication * )auth
error:(NSError * )error
{
if(!error)
{
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Success Authorizing with Google"
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
我正在为GTMOAuth2Authentication 使用https://www.googleapis.com/auth/userinfo.profile 范围,现在我想获取用户基本信息,例如姓名、年龄、电子邮件等。
那么我怎样才能得到所有的细节呢??
我搜索了很多,但没有找到任何东西。
How to get OAuth2 user information in iOS? 的问题可能重复,但也无济于事。
请帮忙
【问题讨论】:
-
您必须将您的 viewController 的 signIn.shouldFetchGoogleUserProfile 设置为 YES。
viewController.signIn.shouldFetchGoogleUserProfile = YES; -
请检查我的答案,如果它不起作用,请告诉我。 @tosa
标签: iphone ios oauth-2.0 google-oauth