before this method, I call the Authenticate function and get the AuthId. and there are no other request is made by me. Whether there are any wrong with my authentication method. Authentication is done as following
-(BOOL)logIn:(NSString *)userName password:(NSString *)password { userName=@"rup289..."; password=@"sush...."; NSURL *url=[NSURL URLWithString:@"https://www.google.com/accounts/ ClientLogin"]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; //NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; NSString *post =[[NSString alloc] initWithFormat:@"accountType==GOOGLE&Email=%@&Passwd= %@&service=lh2&source=test",userName,password]; NSLog(post); NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; [request setURL:url]; [request setHTTPMethod:@"POST"]; [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; [request setHTTPBody:postData]; /* when we user https, we need to allow any HTTPS cerificates, so add the one line code,to tell teh NSURLRequest to accept any https certificate, i'm not sure about the security aspects */ //[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[url host]]; NSError *error; NSHTTPURLResponse *response; NSData *urlData=[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *data=[[NSString alloc]initWithData:urlData encoding:NSUTF8StringEncoding]; NSLog(@"%@",data); NSArray *seperated=[data componentsSeparatedByString:@"\n"]; if([seperated count]>0) { for (int i=0; i<[seperated count]; i++) { if([[seperated objectAtIndex:i] hasPrefix:@"Auth"]) { soapTestAppDelegate *appDelegate = (soapTestAppDelegate *) [[UIApplication sharedApplication] delegate]; appDelegate.PicasaAuth=[seperated objectAtIndex:i]; return TRUE; } } } //NSDictionary *temp= [response allHeaderFields]; // NSLog([temp description]); // // NSString *temp2= [temp objectForKey:@"Apisessiontag"]; // if(temp2!=nil && [temp2 length]>0) // { // LinksifyAppDelegate *appDelegate = (LinksifyAppDelegate *) [[UIApplication sharedApplication] delegate]; // appDelegate.apiSessionString=temp2; // return TRUE; // } // else // { // return FALSE; // } return FALSE; } On Mar 17, 8:14 pm, Detlev Schwabe <dschw...@google.com> wrote: > This error message means that your auth token has probably expired or has > become invalid for other reasons (e.g. user has changed his password). > You will need to re-authenticate the user. > > On Wed, Mar 17, 2010 at 7:59 AM, Rupesh <rup28...@gmail.com> wrote: > > Hi all, > > i am trying to upload the image on the Album of my account.But above > > specified error is received. Please suggest where I do the mistake. > > code is following > > > -(NSData *)setProfilePhoto:(NSData *)photoContent > > { > > NSString *urlString1 = [NSString stringWithFormat:@"http:// > > picasaweb.google.com/data/feed/api/user/rup28...@gmail.com/albumid/ > > default"]; > > //NSString *urlString1 = [NSString stringWithFormat:@"http:// > > picasaweb.google.com/data/feed/api/user/rup28...@gmail.com/albumid/ > > 108075885848736134359"]; > > > NSString *result; > > NSData *responseData; > > �...@try { > > //NSURL *url = [[NSURL alloc] initWithString:urlString1]; > > // NSMutableURLRequest *req = [[NSMutableURLRequest alloc] > > initWithURL:url]; > > // [req setHTTPMethod:@"POST"]; > > > NSString *postLength = [NSString stringWithFormat:@"%d", > > [photoContent length]]; > > > NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] > > init] > > autorelease]; > > [request setURL:[NSURL URLWithString:urlString1]]; > > [request setHTTPMethod:@"POST"]; > > soapTestAppDelegate *appDelegate = (soapTestAppDelegate *) > > [[UIApplication sharedApplication] delegate]; > > > // post without metadata > > [request setValue:@"image/jpeg" forHTTPHeaderField:@ > > "Content-Type"]; > > [request setValue:postLength forHTTPHeaderField:@ > > "Content-Length"]; > > [request setValue:@"abc.jpg" forHTTPHeaderField:@"Slug"]; > > NSString* authorizationString = [NSString > > stringWithFormat:@"GoogleLogin auth=%@",appDelegate.PicasaAuth]; > > //[request setValue:authorizationString > > forHTTPHeaderField:@"Authorization"]; > > [request setValue:@"2" forHTTPHeaderField:@"GData-Version"]; > > > [request setHTTPBody:photoContent]; > > > NSHTTPURLResponse* response = nil; > > NSError* error = [[NSError alloc] init]; > > NSLog(@"Request : %@", request); > > responseData = [NSURLConnection > > sendSynchronousRequest:request > > returningResponse:&response error:&error]; > > result = [[NSString alloc] initWithData:responseData > > encoding:NSUTF8StringEncoding]; > > NSLog(@"Response Code: %d", [response statusCode]); > > NSLog(@"Result: %@", result); > > //[url release]; > > [request release]; > > } > > �...@catch (NSException* ex) { > > NSLog(@"Error: %@",ex); > > } > > return responseData; > > > } > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Picasa Web Albums API" group. > > To post to this group, send email to > > google-picasa-data-...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-picasa-data-api+unsubscr...@googlegroups.com<google-picasa-data-api%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-picasa-data-api?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Picasa Web Albums API" group. To post to this group, send email to google-picasa-data-...@googlegroups.com. To unsubscribe from this group, send email to google-picasa-data-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-picasa-data-api?hl=en.