More: Group API calls from the iOS SDK? Authorization: the sequel
  • Given that a group has been created (by me) and now other users can join the group [thank you for your clarification on the token usage, aaronpk**], how do I authorize myself to send messages to the group?
    I see the example in the docs using an OAuth token, which I'm familiar with from other APIs, but I thought that the OAuth was effectively built in to the saved session when using the iOS SDK. 

    Here's my code and response:

    // send a message to all the users in the group

        NSMutableDictionary *params = [[NSMutableDictionary alloc] init];

        [params setObject:[NSNumber numberWithBool:true] forKey:@"push"];

        [params setObject:@"Hello everyone!" forKey:@"text"];


        NSURLRequest *r = [[LQSession savedSession] requestWithMethod:@"POST" path:@"/group/message/ab4NEKC0p" payload:params];

        [[LQSession savedSession] runAPIRequest:r completion:^(NSHTTPURLResponse *response, NSDictionary *responseDictionary, NSError *error) {

            NSLog(@"Response for sending message to National Fraternity Tappa Kegga Day: %@ error:%@", responseDictionary, error);



      error = "access_denied";

        "error_code" = 403;

        "error_description" = "You are not authorized to send messages to this group";

    Is my call malformed again?



  • 2 Comments sorted by
  • You'll see this error if the user trying to send the message is not part of the group or didn't create it. Only the creator of the group or anyone who's joined the group as "publishing" can do this. If you made the group with "open" for visibility and publish_access, then all you'll need to do is run group/join/:token as this user first, and then the group/message/:token calls will work.
  • Yes! It works!

    It seems I had created the group before with an anonymous account, but then was likely disassociated from that initial account since I'd reset the simulator for a fresh run. So it probably deleted my account information. Or something. 

    So from now on, I'll just make sure the user attempting to send the message has joined the group first. 

    Thanks for keeping me from going too far down the OAuth "hole". The SDK really makes that part so easy.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion