tianshanxuester / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

GDataOAuthViewControllerTouch No Longer Works #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to use GDataOAuthViewControllerTouch to authenticate
2.  Immediately returns an error 400 "The operation could not be completed."
3.

What is the expected output? What do you see instead?
The sign in screen, that had been working for several weeks. 

What version of the product are you using? On what operating system?
IPad Simulator 3.2

Please provide any additional information below.
Not sure if I was banned or what is going on.  Also, the HTTPFetcher 
setIsLoggingEnabled:YES] did not work.  A tip on that would be helpful. 

Original issue reported on code.google.com by johnlaba...@gmail.com on 6 Nov 2010 at 2:34

GoogleCodeExporter commented 9 years ago
I just tried signing in with the sample app in the simulator, and had no 
trouble.

Try putting breakpoints in the GDataSignIn class at the requestFetcher: 
callback methods, and look at [error userInfo] for additional details about the 
error.

Be sure to include GDataHTTPLogging.m/h in your project and define DEBUG=1 to 
get logging and debugging facilities.

The mailing lists should be used for support and questions, rather than the 
issue tracker.

GData: http://groups.google.com/group/gdata-objectivec-client

GTM OAuth: http://groups.google.com/group/gtm-oauth

Original comment by gregrobbins on 6 Nov 2010 at 3:42

GoogleCodeExporter commented 9 years ago
Weird.  I didn't see anything requiring #define DEBUG 1 in the header file, if 
indeed that is what you mean.  In any event including the header and #defining 
DEBUG 1 did not work for logging.   

The BAD request occurs as I push the controllers userInfo on the error is: data 
= <54696d65 7374616d 70206973 20746f6f 20666172 2066726f 6d206375 7272656e 
74207469 6d653a20 31323839 30363932 38350a0a>;
Not sure what to make of a bunch of hex strings.  

The callback failedWithError appears to be called just after the view 
controller is pushed on the navigation controller's stack.  As it is supposed 
to handle authentication soup-to-nuts through its own web view, and I am not 
making the request myself, there is at least something very nonobvious going on 
in the GData code causing it to return the (quite unhelpful) "Bad Request" 
response.  

In other words it simply fails to get the authentication page for some reason.  

The code is fairly straight forward, mostly taken from the example.  Nothing 
crazy here. 

-(BOOL) authenticate { 

    GDataOAuthViewControllerTouch * authVC = [[[GDataOAuthViewControllerTouch alloc] initWithScope:[GDataServiceGoogleDocs authorizationScope]
                                                                                          language:nil
                                                                                    appServiceName:@"Transcript 0.1: Google Docs"
                                                                                          delegate:self
                                                                                  finishedSelector:@selector(viewController:finishedWithAuth:error:)] autorelease];

    [self.navController pushViewController:authVC animated:YES];
    return NO;
}
-(GDataOAuthAuthentication *) getValidAuthorizer {
    GDataOAuthAuthentication * auther = [GDataOAuthViewControllerTouch authForGoogleFromKeychainForName:@"ipadTranscript"];
    if (![auther canAuthorize]) { 
        auther = nil; 
    } 
    return auther;
}
- (void)viewController:(GDataOAuthViewControllerTouch *)viewController
      finishedWithAuth:(GDataOAuthAuthentication *)auth
                 error:(NSError *)error {
    if (error != nil) {
        UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"Authentication Failed" message: [error localizedDescription] delegate: nil cancelButtonTitle: @"Ok" otherButtonTitles: nil];
        [someError show];
        [someError release];

        //alert that authentication failed and leave viewController pushed.
    } else {
        [self.navController popViewControllerAnimated:YES]; 
        [self createDocBrowserWithAuthorizer:auth];
        [self.docBrowser fetch]; 
    }
}

Original comment by johnlaba...@gmail.com on 6 Nov 2010 at 7:09

GoogleCodeExporter commented 9 years ago
That hex is the string "Timestamp is too far from current time: 1289069285".

Perhaps the system clock is far from correct.

The library projects may string logging code if the DEBUG compiler flag is not 
set.

Original comment by gregrobbins on 6 Nov 2010 at 7:36

GoogleCodeExporter commented 9 years ago
Many thanks for the superb help on Saturday!  Looks like my machine may be time 
traveling..

Original comment by johnlaba...@gmail.com on 6 Nov 2010 at 9:38

GoogleCodeExporter commented 9 years ago
Thanks  gregrobbins ,I also solved the same problem.

Original comment by burningc...@gmail.com on 22 Jun 2011 at 3:09