PubSub connection

Hey,
I want to use Twitch PubSub in my project. I am implementing this code to listen to pubsub https://github.com/twitchdev/pubsub-samples (Taken from documentation). Even if i am passing valid Auth Token, the response shows invalid auth. Below is response i am getting:

INFO: Socket Opened
SENT: {“type”:“PING”}
RECV: {“type”:“PONG”}
SENT: {“type”:“LISTEN”,“nonce”:“UYkdhNAWaHiMzNQ”,“data”:{“topics”:[“channel-bits-events-v1.96087292”],“auth_token”:“REMOVEDAUTH”}}
RECV: {“type”:“RESPONSE”,“error”:“ERR_BADAUTH”,“nonce”:“UYkdhNAWaHiMzNQ”}
SENT: {“type”:“PING”}

Am i doing something wrong in this code ?

  1. Don’t leak a “real auth” that’s basically like passing a secret!

  2. For channel-bits-events-v1.96087292 you need to pass an auth_token that has any scope applied to it but is for user 96087292

The most reliable auth method is

For such a thing.

Edit: I tested the key you provided. It belongs to you not to the channel you are trying to obtain bits events for

But how can i get auth_token of specific channel i want embedded videos,chats etc.? I want to get embedded videos, viewers and chat for particular channel in real-time. @BarryCarlyon

You must request that the broadcaster go thru the auth flow to grant permission to access the data.

If that’s not possible for your use case, you can parse the anonymous data that is provided via Twitch Chat itself

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