The community forums are in BETA and closed to the public.

Message: 'Forbidden' when trying to add channel to channel group in PubNub

I am trying to add a channel to a channel group and associate an auth_key for pub/sub to this channel using this code:

        callback: function(success) {
                        channel: channelName,
                        auth_key: userAuthKeyForChannel,
                        read: true,
                        write: true,
                        callback: function(response){
                            res.status(200).json({response: {ChatChannel: createdRecord}, token:req.token});

        error: function(err) { return hlprs.sendResWithErr(res,err,500,true,'Error while trying to add channel to group in our messaging platform'); },
        channel: channelName,
        channel_group: channelGroupName

But I always get the response

{ message: 'Forbidden', 
     payload: { 'channel-groups': [ ':90c977bbc169b12054706b0de07dd9f2' ] } 

When I disable Access Manager in PubNub admin panel, it (obviously) works perfectly. I'd also like to mention that this request takes place in a server backend where pubnub is initialized with subscriberkey, publishkey and secret_key. There are no other pubnub requests prior to this one and there's no one subscribed in other environments.

I suppose I need to grant permissions to the backend at the application level before proceeding with adding the channel in a group, however I am unsure how to properly do this.

StackOverflow Link:

Hey Thanos,

Hopefully the support in the SO thread provided you with enough help to get things running.

In order to add/remove channels to a group you would need to grant "manage" permission to the auth key. Add manage: true

Login or Signup to post a comment