I use this which works:
var tokenPayload = {
exp: Math.floor(new Date().getTime() / 1000) + 60,
channel_id: ''+channel,
role: 'external',
pubsub_perms: {
send: [
'broadcast'
]
}
}
Side note I’m using https://www.npmjs.com/package/jsonwebtoken instead 