-1001 operation cannot be completed error

108 views
Skip to first unread message

Justin Goyanko

unread,
Nov 14, 2014, 6:28:38 AM11/14/14
to gtm-o...@googlegroups.com

Hi,

I've been trying this code below and it's giving me a -1001 error like this:

The operation couldn’t be completed. (com.google.GTMOAuth2 error -1001.) ------- Error Domain=com.google.GTMOAuth2 Code=-1001 "The operation couldn’t be completed. (com.google.GTMOAuth2 error -1001.)" UserInfo=0xe9e3ab0 {request=<NSMutableURLRequest: 0xe9ca940> { URL: https://accounts.google.com/o/oauth2/token }}

Would anyone know why it's giving me this generic error ? I check the network and it seems the program is not sending any HTTP requests out.


auth = [GTMOAuth2Authentication authenticationWithServiceProvider:@"Test"

                                                                                      tokenURL:[NSURL URLWithString:@"https://accounts.google.com/o/oauth2/token"]

                                                                                   redirectURI:[NSURL URLWithString:@"http://localhost"]

                                                                                      clientID:client

                                                                                  clientSecret:secret];

    auth.scope = @"https://www.googleapis.com/auth/prediction";


NSURL *url = [NSURL URLWithString:@"https://www.googleapis.com/auth/prediction"];

        NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

        [auth authorizeRequest:request completionHandler:^(NSError *error){

            if(error) {

                NSLog(@"ERROR!!!! %@ ------- %@", [error localizedDescription] , [error debugDescription]);

            } else {

                NSLog(@"SUCCESS!!!");

            }

        }];




Greg Robbins

unread,
Dec 4, 2014, 4:41:01 PM12/4/14
to gtm-o...@googlegroups.com
Scope strings are not valid request URLs; they are meaningful only as scope parameters when requesting authorization from a service.

An auth object cannot be used immediately after creation; the auth must first get a refresh token, either from the user signing in or from the keychain.

Reply all
Reply to author
Forward
0 new messages