verify YouTube Log in from iPhone app

25 views
Skip to first unread message

be...@dakotacom.net

unread,
Dec 26, 2012, 8:16:17 PM12/26/12
to gdata-objec...@googlegroups.com
I have an app where the user can video an event and then upload it to YouTube from inside the app.  I have the user sign in using their username and password.  It is then saved and used for further uploads.  All works well if the sign in is correct.  However if the username or password is entered incorrectly they are saved as such and then when the user tries to upload a video an error appears saving the upload failed.  What I would like to do is have the user information verified before it is saved and the user directed to reenter their information until it is correct.  I am using the following code to have the user input their information.


- (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 = [accountView.text 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;

    

   

}



Is there a way to verify the user information or that the service is indeed returned,  Then I could save the info and if not returned then have an error message appear.

Greg Robbins

unread,
Dec 27, 2012, 1:32:14 AM12/27/12
to gdata-objec...@googlegroups.com
The setUserCredentialsWithUsername:password: method has long since been deprecated, as has the ClientLogin protocol upon which it's based. 


Apps should use OAuth 2 for signing in users. The gtm-auth2 controllers handle saving the user's authorization to the keychain.


Additionally, apps should be using the newer, more efficient JSON-based library for YouTube, rather than the older XML GData API.


There is a sample YouTube application provided with the library.
Reply all
Reply to author
Forward
0 new messages