我關注了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