TwitchLib / TwitchLib.PubSub

PubSub component of TwitchLib.
38 stars 51 forks source link

ERR_BADAUTH for Listening on Mod-Actions #50

Closed eddithefreak closed 3 years ago

eddithefreak commented 4 years ago

Hey guys,

I have following issue:

(1) // JoinedChannel is of type "TwitchLib.Api.V5.Models.Channels.Channel"   
(2) twitchPubSub.ListenToBitsEvents(JoinedChannel.Id);
(3) twitchPubSub.ListenToChatModeratorActions(JoinedChannel.Id, JoinedChannel.Id);
(4) twitchPubSub.ListenToSubscriptions(JoinedChannel.Id);
(5) twitchPubSub.ListenToVideoPlayback(JoinedChannel.Name);
(6) twitchPubSub.ListenToFollows(JoinedChannel.Id);

This way, all topics fail with "ERR_BADAUTH", but when I remove line 3 everything works fine.

The auth-token should be fine, since I requested channel:moderate in the URL, too.

So far, I saw in the docs of Twitch, that you can listen on this topic with

chat_moderator_actions.<channel ID>

and the code here is listening with:

chat_moderator_actions.<own_ID>.<channel ID>

Am I getting something wrong or is the implemented way deprecated?

Regards, Edgar

JammyGeeza commented 4 years ago

Hey @eddithefreak

Did you ever resolve this? I am experiencing this same issue but with the following code:

(1) client.ListenToBitsEvents(“channel_id”);
(2) client.ListenToFollows(“channel_id”);
(3) client.ListenToRedemptions(“channel_id”);

If I remove line 1, everything works as expected, but when left in, I get “ERR_BADAUTH” for all 3 topics. I have ensured multiple times that the keys I generate through the Twitch Token Generator site include the read:bits topic. I have also tried generating a key with all topics, which still did not work.

The exact same thing happens if I replace line 1 with client.ListenToSubscriptions(“channel_id”); and generate a key that allows all subscription topics.

I think I read that some topics require an oAuth token to be accessed, but I just can’t figure out what I need to do to and where to implement it.

Thanks,

Jamie

DavidMartinelli commented 3 years ago

Hello @JammyGeeza @eddithefreak I am experiencing the same issue of yours.

My case is about PubSub. I did some experiment and I see that I'm able to listen for new follow but as soon as I start listening, for example, for new subs (with affiliate account) I receive a bad_auth error message and all requests are failing.

Were you able to find a solution?

Thank you, David

swiftyspiffy commented 3 years ago

ERR_BADAUTH is generally the result of an invalid/incorrectly scoped oauth token, or an invalid/incorrect channel id (reminder: channel id IS NOT channel username. channel id is a unique number (though treated as string) assigned to each user. you can get it by hitting the twitch api GetUsers). Closing this. Feel free to reopen if needed.