My favorites | Sign in
Project Home Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 4: Authentication suddenly failing with no error - did Google change the API?
6 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----

Sign in to add a comment
Reported by, Dec 31, 2011
I've been using these classes for weeks now with no problems but a few days ago it suddenly stopped working without me touching anything. I suspect Google changed something with their API but I can't work out what.

My Google Reader client appears to successfully authenticate and no errors are returned, yet when I ask it for the number of subscriptions with the URL it returns:


If I paste the same URL into my web browser when I am logged into Google, it returns the subscriptions successfully. If I then log out and try it, it returns the same data my app returns, so it would seem to be an authentication issue.

It seems like I'm not the only one to have experienced it suddenly fail to work in the past few days, although what caused it remains unknown:

Can anyone else shed some light on this?

I'm running it on OS X 10.6.8 using Xcode 4.2.
Dec 31, 2011
Here's my code btw. I haven't modified the gtm-oauth classes at all.

- (void)connectToSavedAccountSession
    // Connect to saved account if available
    GTMOAuth2Authentication *auth = [GTMOAuth2WindowController authForGoogleFromKeychainForName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName] 
    [mAuth autorelease];
    mAuth = [auth retain];

- (void)signInWithDelegate:(id)delegate parentWindow:(NSWindow*)window
    [self signOut];
    // For Google APIs, the scope strings are available
    // in the service constant header files.
    NSString *scope = @"";
    // Display the autentication sheet
    GTMOAuth2WindowController *windowController;
    windowController = [GTMOAuth2WindowController controllerWithScope:scope
                                                     keychainItemName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName]
    // During display of the sign-in window, loss and regain of network
    // connectivity will be reported with the notifications
    // kGTMOAuth2NetworkLost/kGTMOAuth2NetworkFound
    // See the method signInNetworkLost: for an example of handling
    // the notification.
    // Optional: Google servers allow specification of the sign-in display
    // language as an additional "hl" parameter to the authorization URL,
    // using BCP 47 language codes.
    // For this sample, we'll force English as the display language.
    NSDictionary *params = [NSDictionary dictionaryWithObject:@"en"
    windowController.signIn.additionalAuthorizationParameters = params;
    // Optional: display some html briefly before the sign-in page loads
    NSString *html = @"<html><body><div align=center>Loading sign-in page...</div></body></html>";
    windowController.initialHTMLString = html;
    // Most applications will not want the dialog to remember the signed-in user
    // across multiple sign-ins, but the sample app allows it.
    //    windowController.shouldPersistUser = [mPersistUserCheckbox state];
    // By default, the controller will fetch the user's email, but not the rest of
    // the user's profile.  The full profile can be requested from Google's server
    // by setting this property before sign-in:
    // windowController.signIn.shouldFetchGoogleUserProfile = YES;
    // The profile will be available after sign-in as
    //   NSDictionary *profile = windowController.signIn.userProfile;
    [windowController signInSheetModalForWindow:window

- (void)signOut 
    if ([mAuth.serviceProvider isEqual:kGTMOAuth2ServiceProviderGoogle]) {
        // Remove the token from Google's servers
        [GTMOAuth2WindowController revokeTokenForGoogleAuthentication:mAuth];
    // Remove the stored Google authentication from the keychain, if any
    [GTMOAuth2WindowController removeAuthFromKeychainForName:[NSString stringWithFormat:@"%@ - Google Reader",self.clientName]];
    // Discard our retained authentication object
    [mAuth release];
    mAuth = nil;

- (BOOL)isAuthorized
    return mAuth.canAuthorize;

- (void)windowController:(NSWindowController*)windowController finishedWithAuth:(GTMOAuth2Authentication*)theAuth error:(NSError*)error
    if (error) NSLog(@"Error: %@",[error localizedDescription]);
    [mAuth release];
    mAuth = [theAuth retain];
Jan 3, 2012
Project Member #5
This sounds like an issue with the Reader API, not with the gtm-oauth2 controllers.
Sign in to add a comment

Powered by Google Project Hosting