0

I'm using the GTL framework to integrate Google Plus in my cocoa application.

When I try to insert a new moment it fails with error 401 (unauthorized). In this post the TO solved this problem by including the request_visible_actions parameter while redirecting the user to the authorization page. But how to do that?

I got an instance of a GTMOAuth2WindowController that automatically creates the URL. So how can I add the request_visible_actions parameter? When that's not possible, how to create the whole URL?

Community
  • 1
  • 1
floschliep
  • 513
  • 5
  • 14
  • May you show me how you set-up the Google Plus Moment POST request? Mine isn't working :( (http://stackoverflow.com/questions/24061521/cannot-insert-moment-google-plus-api) – Supertecnoboff Jun 09 '14 at 14:37

1 Answers1

3

I solved the problem! I had to create the GTMOAuth2WindowController like this:

GTMOAuth2Authentication *auth = [GTMOAuth2SignIn standardGoogleAuthenticationForScope:kGTLAuthScopePlusLogin clientID:kClientID clientSecret:kClientSecret];
NSString *authURLString = [[[GTMOAuth2SignIn googleAuthorizationURL] absoluteString] stringByAppendingString:@"?request_visible_actions=http://schemas.google.com/AddActivity"];

NSBundle *frameworkBundle = [NSBundle bundleForClass:[GTMOAuth2WindowController class]];
GTMOAuth2WindowController *windowController = [GTMOAuth2WindowController controllerWithAuthentication:auth
                                                                                                       authorizationURL:[NSURL URLWithString:authURLString]
                                                                                                          keychainItemName:nil
                                                                                                           resourceBundle:frameworkBundle];
floschliep
  • 513
  • 5
  • 14
  • SO you are connecting "?request_visible_actions=http://schemas.google.com/AddActivity" to "https://accounts.google.com/o/oauth2/auth/"??? – Supertecnoboff Jun 09 '14 at 13:51