I’m trying to listen to the bit events topic from the pubsub websocket.
First I get the OAuth2 token, via https://id.twitch.tv/oauth2/token?client_id=XXX&client_secret=XXX&grant_type=client_credentials&scope=channel:read:subscriptions+bits:read+chat:read
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
}
};
ws.send(JSON.stringify(message));
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.