PubSub POST JWT 403 Response

Trying to test out PubSub with my extension and I can’t quite figure out why I’m getting a 403 response.
The verify works fine. I’m using the extension owner for user id, the secret from the extension secret page and the client id from the extension page.

try {
    var decoded = jwt.verify(req.query.token, new Buffer(secret, 'base64'));
    var exp = decoded.exp + 3600;
    var userid = 0;
    if (decoded.user_id) {
        var payload = new Object();
        payload.exp = exp;
        payload.user_id = ext_uid;
        payload.role = "external";
        payload.channel_id = decoded.channel_id;
        payload.pubsub_perms = { listen: ['broadcast'], send: ['*'] };
        var token = jwt.sign(payload, new Buffer(secret, 'base64'));{
            url: "" + decoded.channel_id,
                "content_type": 'application/json',
                "message": "{foo:'bar'}",
                "targets": ['broadcast']
            headers: {
                "Authorization": "Bearer: " + token,
                "Client-Id": cid,
                "content-type": "application/json"
        }, function (error, response, body) {

} catch (err)


payload.channel_id = ''+decoded.channel_id;

IE: cast channel_id as a STRING not a INTEGER

Aside from that. Code looks good

Yah, tried that didn’t seem to matter. You know of anything to do with extension settings that could do this? Perhaps since it’s still in local host test? I really have no idea at this point.

You have an extra char in your authorization header. It should look like this

Authorization: Bearer {jwt}

instead of

Authorization: Bearer: {jwt}
1 Like

Fixed. I wonder how many years of my life tunnel vision has wasted. Thanks a bunch.