1

I need to know the rss list from google account. I got sid and auth by the following api, and it succeeded.

   // login and get sid & auth
NSURL* loginURL = [NSURL URLWithString:@"https://www.google.com/accounts/ClientLogin"];
ASIFormDataRequest* loginRequest = [ASIFormDataRequest requestWithURL:loginURL];
loginRequest.useCookiePersistence = NO;

[loginRequest addRequestHeader:@"User-Agent" value:@"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4"];

[loginRequest setPostValue:@"reader" forKey:@"service"];
[loginRequest setPostValue:@"scroll" forKey:@"source"];
[loginRequest setPostValue:@"http://www.google.com/" forKey:@"continue"];

[loginRequest setPostValue:self.login forKey:@"Email"];
[loginRequest setPostValue:self.password forKey:@"Passwd"];

[loginRequest startSynchronous];

but it failed when trying to get token.

 NSString *lUrlString = @"http://www.google.com/reader/api/0/subscription/list?output=json&client=scroll";
_rssRequest = [[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:lUrlString]];    

NSString *authParam = [NSString stringWithFormat:@"GoogleLogin auth=%@", self.auth];  

[_rssRequest addRequestHeader:@"Authorization" value:authParam];

[_rssRequest addRequestHeader:@"Cookie" value:[NSString stringWithFormat:@"SID=%@", [self sid]]];

[_rssRequest setHeadersReceivedBlock:^(NSDictionary *responseHeaders) {

    NSLog(@"%@",  responseHeaders);

}];

[_rssRequest setRequestMethod:@"GET"];

[_rssRequest setValidatesSecureCertificate:NO];  

[_rssRequest setDelegate:self];    

[_rssRequest setDidFailSelector:@selector(rssLoadFailed:)];

[_rssRequest setDidFinishSelector:@selector(rssLoadFinish:)];    

[_rssRequest startAsynchronous];    



- (void)rssLoadFailed:(ASIHTTPRequest *)req

{

NSError *error = [req error];

NSLog(@"%@", [error description]);

NSLog(@"Get token Failed: %d %@", [req responseStatusCode], [req   responseStatusMessage]); 

}

- (void)rssLoadFinish:(ASIHTTPRequest *)req

{

NSLog(@"%@", req);

NSData * returnData = [req responseData];

NSString* response;

response = [[NSString alloc] initWithData:returnData encoding:NSASCIIStringEncoding];

NSLog(@"%@", response);

}

When i tried to get rss list, I got a 401 error. Anybody knows what is wrong with retriving reading list using google reader api? Thanks in advance for your help!

Chris Snow
  • 23,813
  • 35
  • 144
  • 309
waterdudu
  • 61
  • 4

1 Answers1

0

You can find the solution for this question in my answer of following post. Google Reader Feed Import

Thanks.

Community
  • 1
  • 1