Pubsub error with valid Auth Token

I’m trying to listen to the bit events topic from the pubsub websocket.

First I get the OAuth2 token, via

That works, and the response looks like:

  • access_token : XXX
  • expires_in : 4781941
  • scope: [channel:read:subscriptions,chat:read,bits:read]
  • token_type : bearer

Next I connect to the pubsub websocket, PINGing and PONGing work just fine.

Then, I use the access_token above to listen to the “channel-bits-events-v2” topic, like so:

message = {
        type: 'LISTEN',
        nonce: 'ABC123',
        data: {
            topics: ["channel-bits-events-v2.452018475"],
            auth_token: XXX


The response :

  • type: RESPONSE
  • error : ERR_BADAUTH
  • nonce : ABC123

I can use the auth_token successfully to get subscribers via the Helix Twitch API. So I know that works…
The User ID is correct…

Not sure what else to do.

You need a user access token. Not a app access token

client_credentials is a server to server token which doesn’t represent a server

The correct token is obtained with code

It’s documented here:

1 Like

Wow! Everything works now~

Thanks for the prompt and excellent reply.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.