I am trying to listen to channel activities using PUBSUB API. I am constantly getting ERR_BADAUTH. Upon research, I came to know that I am providing the my user oAuth token instead of channel oAuth token (whose events I am trying to listen to). How can I generate or listen to recent activities of a channel using WebSockets if have the channel ID?
To get an OAuth token for a channel you need to have the broadcaster of that channel go through your OAuth flow https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#oauth-authorization-code-flow
This will give you a token for their channel. If you’re attempting to access Pubsub topics that require a certain scope then you’ll have to request them during that OAuth process.
I am requesting the scopes during oAuth process, the only thing is my end user can subscribe to any channel they want and it means that I don’t have a control over getting an oAuth token from streamer.
If pubsub requires oAuth from third party channel then is there a way to get list of recent events to a specific channel if I have its channel id?
It depends what events you need. Joining Twitch chat will give you some events when they happen, for other things you may want to look into a webhook for the streams endpoint.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.