oAuth2 在 iOS7 中检索配置文件电子邮件



我按照本教程进行操作,能够成功进行身份验证并获取访问令牌,现在我正在努力了解如何在关闭 webview 并重新加入我的控制器之前获取与用户配置文件关联的电子邮件。

有什么建议吗?我知道谷歌为此提供了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 方法发出经过身份验证的请求,并将userId设置为 me 。人员资源具有emails数组,type设置为 account 的电子邮件是其已验证的电子邮件。