title: Oauth user authentication from iOS device to google app engine
body: <p>I'm developing an iOS app that needs to get/put data to a google app engine server application I am also developing.  Each user of the iOS app will user their google identity to access the server portion of the application.  I am trying to use the nifty <a href="http://code.google.com/p/gtm-oauth/" rel="nofollow">gtm-oauth library</a>.   I have used Google's service to <a href="https://www.google.com/accounts/ManageDomains" rel="nofollow">register my domain</a> in order to get my OAuth Consumer Key and  OAuth Consumer Secret.  </p>
  
  <p>When I create the code to access Google's contact list for a user it works fine but I cannot get it to work against my app engine application.  When I try I am getting an error "The service you requested is not available yet.  Try again in 30 seconds" in the authentication controller view.   In the app engine console I see a request to /_ah/OAuthGetAccessToken which fails (I have not provided anything at that path).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>-(IBAction)authButtonClicked: (id) sender {
      [GTMHTTPFetcher setLoggingEnabled:YES];
      NSURL *requestURL = [NSURL URLWithString:@"https://mysite.appspot.com/_ah/OAuthGetRequestToken"];
      NSURL *accessURL = [NSURL URLWithString:@"https:/mysite.appspot.com/_ah/OAuthAuthorizeToken"];
      NSURL *authorizeURL = [NSURL URLWithString:@"https://mysite.appspot.com/_ah/OAuthGetAccessToken"];
      NSString *scope = @"http://mysite.appspot.com/";
      GTMOAuthAuthentication *auth = [self myCustomAuth];
      GTMOAuthViewControllerTouch *viewController;
      viewController = [[GTMOAuthViewControllerTouch alloc] initWithScope:scope
                                                              language:nil
                                                       requestTokenURL:requestURL
                                                     authorizeTokenURL:authorizeURL
                                                        accessTokenURL:accessURL
                                                        authentication:auth
                                                                appServiceName:@"My Service"
                                                                  delegate:self
                                                          finishedSelector:@selector(viewController:finishedWithAuth:error:)];
      [[self navigationController] pushViewController:viewController animated:YES];
  }
  
  - (GTMOAuthAuthentication *)myCustomAuth {
      NSString *myConsumerKey = @"mysite.appspot.com";    // from google registration
      NSString *myConsumerSecret = @"xxxxxxxxxxxxxxx";   //  from google registration
      GTMOAuthAuthentication *auth;
      auth = [[GTMOAuthAuthentication alloc]             initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
                                                          consumerKey:myConsumerKey
                                                           privateKey:myConsumerSecret];
      auth.serviceProvider = @"Custom Auth Service";
      return auth;
  }
  </code></pre>
  
  <p>Am I using the correct URLs?  Is the scope correct? What would cause that message?</p>