Iphone 如何在Gdata视频上传到您的视频中验证id密码

Iphone 如何在Gdata视频上传到您的视频中验证id密码,iphone,youtube-api,Iphone,Youtube Api,要在YouTube上上传视频,我使用的是Gdata示例代码 它工作得很好。但在我的应用程序中,我需要在用户尝试上传视频之前验证用户的用户名和密码 我可以用Gdata服务吗 感谢您的帮助。以下是客户端登录Youtube的方法: - (BOOL)login:(NSString *)strusername password:(NSString *)strpassword { NSMutableURLRequest *request = [NSMutableURLRequest

要在YouTube上上传视频,我使用的是Gdata示例代码

它工作得很好。但在我的应用程序中,我需要在用户尝试上传视频之前验证用户的用户名和密码

我可以用Gdata服务吗


感谢您的帮助。

以下是客户端登录Youtube的方法:

- (BOOL)login:(NSString *)strusername password:(NSString *)strpassword
{
   NSMutableURLRequest *request = [NSMutableURLRequest 
                                requestWithURL:[NSURL URLWithString:@"https://www.google.com/accounts/ClientLogin"]];

   NSString *params = [[NSString alloc] initWithFormat:@"Email=%@&Passwd=%@&service=youtube&source=&continue=http://www.google.com/",username,password];
   [request setHTTPMethod:@"POST"];
   [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
   [params release];
   [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-type"];

   NSHTTPURLResponse *response;
   NSError *error;
   [request setTimeoutInterval:120];
   NSData *replyData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];    

   NSString *replyString = [[[NSString alloc] initWithData:replyData encoding:NSUTF8StringEncoding] autorelease];
   if([replyString rangeOfString:@"Auth="].location!=NSNotFound)
   {
    NSString *authToken=[[replyString componentsSeparatedByString:@"Auth="] objectAtIndex:1];
    NSLog(@"Auth : %@",authToken);
    return YES;
   }
   else
   {
    return NO;
   }
 }