I have an app in which the user uploads a video to youtube. I have the user input their password and username to sign in and then they input the "title", "description", "tags", "category", and "privacy setting" i.e. public, private, unlisted. All works well. However I am not able to verify that the password for the given username is valid or even if the username is valid. When the password and username are filled in and the "sign in" button is tapped these are saved into the documents directory as password.txt and username.txt. Then these are used to complete the process and in fact loaded from the documents directory upon subsequent uploads until the user signs out, in which case the files are removed.
My problem is I would like to check with YouTube when the user fills in the password and username and goes to save them to make sure they are valid. Can someone help me with this.
This is the code I use to input the username and password as well as developers key to YouTube to get a service to allow uploading video.
and then I use this code to get the URL for uploading
but I am not sure how to use these to check to see if the username and password are matched and compatible and return an error message is they are not . Also I don't want to save them if they are not correct.
If someone can suggest a solution, a tutorial, video or something else to help me accomplish this I would greatly appreciate it.
Thanks
My problem is I would like to check with YouTube when the user fills in the password and username and goes to save them to make sure they are valid. Can someone help me with this.
This is the code I use to input the username and password as well as developers key to YouTube to get a service to allow uploading video.
Code:
- (GDataServiceGoogleYouTube *)youTubeService {
static GDataServiceGoogleYouTube* service = nil;
if (!service) {
service = [[GDataServiceGoogleYouTube alloc] init];
[service setShouldCacheResponseData:YES];
[service setServiceShouldFollowNextLinks:YES];
[service setIsServiceRetryEnabled:YES];
/*[service setUserCredentialsWithUsername:accountView.text password:PasswordDisplayField.text];*/
}
NSString *username = [accountView.text retain];
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
accountView.text = [username stringByTrimmingCharactersInSet:whitespace];
/*if ([accountView.text rangeOfString:@"@"].location == NSNotFound)
{ accountView.text = [kYoutubeUsername stringByAppendingString:@"@gmail.com"]; }*/
if (([accountView.text length] > 0) && ([PasswordDisplayField.text length] > 0))
{ [service setUserCredentialsWithUsername:[accountView.text retain] password:[PasswordDisplayField.text retain]]; }
else
{ [service setUserCredentialsWithUsername:nil password:nil]; }
[service setYouTubeDeveloperKey:devKey];
return service;
}
Code:
NSURL *url = [GDataServiceGoogleYouTube youTubeUploadURLForUserID:kGDataServiceDefaultUser];
but I am not sure how to use these to check to see if the username and password are matched and compatible and return an error message is they are not . Also I don't want to save them if they are not correct.
If someone can suggest a solution, a tutorial, video or something else to help me accomplish this I would greatly appreciate it.
Thanks