我关注了this tutorial,并且能够成功进行身份验证并获得了访问令牌,现在我正在努力了解如何在关闭webview和加入我的控制器之前获取与用户配置文件关联的电子邮件。oAuth2检索iOS7中的配置文件电子邮件
有什么建议吗?我知道Google为此提供了SDK,但如果我的要求可能与我正在使用的教程一致,我不想走这条路线。
if (verifier) {
NSString *data = [NSString stringWithFormat:@"code=%@&client_id=%@&client_secret=%@&redirect_uri=%@&grant_type=authorization_code", verifier,client_id,secret,callbakc];
NSString *url = [NSString stringWithFormat:@"https://accounts.google.com/o/oauth2/token"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[data dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];
receivedData = [[NSMutableData alloc] init];
} else {
// ERROR!
}
//Should I need to call another HTTP to retrieve email (or) email already available part of any other response?
如果我需要调用另一个HTTP,应该调用哪个URL?
嗨,你可以告诉我你是如何进行身份验证的请求来获取people.get API方法并获取所有细节。我也使用跟随你一样的教程。谢谢 – ChenSmile
@Imran:我没有使用这种方法。我只是做了https://developers.google.com/+/mobile/ios/getting-started(唯一的问题是,这增加了我的包大小几乎50MB) – kosa
我也试过这个,但能够从通讯录中获取联系人。你能告诉我怎么能从上面的链接中得到你朋友的电子邮件ID,你有建议我发表评论。 – ChenSmile