1
Ich versuche, den Token von Google Reader für mein iPhone-Projekt zu bekommen. Ich bin in der Lage, die Autorisierung zu bekommen, aber wenn ich um das Token ersuche, bekomme ich eine 403 verbotenGoogle Reader Token Anfrage geben 403 Fehler
Unten ist meine Code-Implementierung. Jede Hilfe wäre willkommen.
//The tokenStorer contains the Authorization key
NSString *tokenStorer = [[NSUserDefaults standardUserDefaults]valueForKey:@"authKey"];
NSLog(@"%@", tokenStorer);
NSDictionary *cookieDictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"www.google.com", @"Host",
@"iReader", @"User-Agent",
@"gzip, deflate", @"Accept-Encoding",
tokenStorer, @"Authorization",
nil
];
//@"Auth", NSHTTPCookieName, tokenStorer, NSHTTPCookieValue, @"./google.com", NSHTTPCookieDomain, @"/", NSHTTPCookiePath, nil];
//NSHTTPCookie *authCookie = [NSHTTPCookie cookieWithProperties:cookieDictionary];
//Google token url "http://www.google.com/reader/api/0/token?client=clientName"
NSURL *url=[[NSURL alloc] initWithString:GOOGLE_READER_TOKEN_URL];
NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc]initWithURL:url];
[urlRequest setHTTPMethod:@"GET"];
[urlRequest setAllHTTPHeaderFields:cookieDictionary];
NSData *reciveData;
NSURLResponse *response;
NSError *error;
reciveData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
NSMutableURLRequest *tokenRequest= [[NSMutableURLRequest alloc] initWithURL:url];
NSString *trial = [[NSString alloc]initWithData:reciveData encoding:NSASCIIStringEncoding];
NSLog(@"%@ %d",trial, response);
[url release];