3
Google 리더 계정에 대한 SID (SessionID)를 성공적으로 가져올 수 있습니다. Google 리더에서 피드를 가져와 다른 작업을 수행하려면 승인 토큰을 얻어야합니다. 이 일을하는 데 문제가 있습니다. 누군가가 약간의 빛을 비출 수 있습니까?Objective-C가있는 Google 리더 API - 토큰 가져 오는 중 문제가 발생했습니다.
//Create a cookie to append to the GET request
NSDictionary *cookieDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"SID",@"NSHTTPCookieName",self.sessionID,@"NSHTTPCookieValue",@".google.com",@"NSHTTPCookieDomain",@"/",@"NSHTTPCookiePath",nil];
NSHTTPCookie *authCookie = [NSHTTPCookie cookieWithProperties:cookieDictionary];
//The URL to obtain the Token from
NSURL *tokenURL = [NSURL URLWithString:@"http://www.google.com/reader/api/0/token"];
NSMutableURLRequest *tokenRequest = [NSMutableURLRequest requestWithURL:tokenURL];
//Not sure if this is right: add cookie to array, extract the headers from the cookie inside the array...?
[tokenRequest setAllHTTPHeaderFields:[NSHTTPCookie requestHeaderFieldsWithCookies:[NSArray arrayWithObjects:authCookie,nil]]];
//This gives me an Error 403 Forbidden in the didReceiveResponse of the delegate
[NSURLConnection connectionWithRequest:tokenRequest delegate:self];
Google의 응답으로 403 Forbidden 오류가 표시됩니다. 아마 제대로하지 않을거야. NSHTTPCookie에 대한 문서에 따라 사전 값을 설정합니다.
너는 나의 구세주가된다. – Justin