I am registering my application for the Google API console. And I get my client secret, client id and two uris redirects .
//● urn:xxxxxxx:oob //● http://localhostxxxxxx
Of course, I use these elements and get a token request for google. But when I click the authorization button (for example, “Do you want to allow this application?” Yes), two answers appear.
If I use urnxxxxxx, I get: "The operation could not be completed. (Com.google.HTTPStatus error 404.)".
//Or If I use http://localhostxxxxxxxxxxxxx and click Yes button, then nothing happens.
What should I do next? (The following code is for a Google reader.)
#import "MasterViewController.h" #import "DetailViewController.h" #import "GTMOAuth2Authentication.h" #import "GTMOAuth2ViewControllerTouch.h" #import "GTMOAuth2WindowController.h" static NSString *const kKeychainItemName = @"Greader"; @interface MasterViewController () { NSMutableArray *_objects; } @end @implementation MasterViewController - (IBAction)authentication:signInToGoogle:(id)sender; {} - (GTMOAuth2Authentication * ) authForGoogle { NSString * url_string = @"http://www.google.com/reader/api/"; NSURL * tokenURL = [NSURL URLWithString:url_string]; NSString * redirectURI = @"xxxxoob"; GTMOAuth2Authentication * auth; auth = [GTMOAuth2Authentication authenticationWithServiceProvider:@"reader" tokenURL:tokenURL redirectURI:redirectURI clientID:@"xxxxx" clientSecret:@"xxxx"]; auth.scope = @"http://www.google.com/reader/api/"; return auth; } - (void)signInToGoogle { GTMOAuth2Authentication * auth = [self authForGoogle]; NSString* auth_string = @"https://accounts.google.com/o/oauth2/auth"; NSURL * authURL = [NSURL URLWithString:auth_string]; GTMOAuth2ViewControllerTouch * viewController; viewController = [[GTMOAuth2ViewControllerTouch alloc]initWithAuthentication:auth authorizationURL:authURL keychainItemName:kKeychainItemName delegate:self finishedSelector:@selector(viewController:finishedWithAuth:error:)]; [self.navigationController pushViewController:viewController animated:YES]; }
source share