TwitchLib.Unity icon indicating copy to clipboard operation
TwitchLib.Unity copied to clipboard

Pubsub bad oauth

Open THENooBlet opened this issue 5 years ago • 2 comments

im having trouble with my token not working ... giving me bad oauth

heres my code

        pubsub = new TwitchPubSub();
        pubsub.OnPubSubServiceConnected += Pubsub_OnPubSubServiceConnected;
        pubsub.OnBitsReceived += Pubsub_OnBitsReceived;
        pubsub.OnSubscribersOnly += Pubsub_OnSubOnly;
        pubsub.OnSubscribersOnlyOff += Pubsub_onSubonlyoff;
        pubsub.OnWhisper += pubsub_onwisper;
        pubsub.OnListenResponse += Pubsub_OnListenResponse;


        pubsub.Connect();



    }

    private void Pubsub_OnPubSubServiceConnected(object sender, EventArgs e)
    {
        client.SendMessage(Twitch.Default.ChannelName, $"pubsub connected!!!");           
        pubsub.ListenToBitsEvents(Twitch.Default.ChannelID);            
        pubsub.SendTopics(Twitch.Default.BotOauth);            
    }

    private void Pubsub_OnBitsReceived(object sender, OnBitsReceivedArgs e)
    {
        client.SendMessage(Twitch.Default.ChannelName ,$"Just received {e.BitsUsed} bits from {e.Username}. That brings their total to {e.TotalBitsUsed} bits!");
    }

    private void Pubsub_OnListenResponse(object sender, OnListenResponseArgs e)
    {
        if (e.Successful)
            client.SendMessage(Twitch.Default.ChannelName,$"Successfully verified listening to topic: {e.Topic}");
        else
            client.SendMessage(Twitch.Default.ChannelName,$"Failed to listen! Error: {e.Response.Error}");
    }
}

} :

i left some code out that has to do with client ...(works) but the botoauth being used in send topics is from swiftyspiffy token generator and all scopes are applyed but i get

newbiestreambot: pubsub connected!!! newbiestreambot: Failed to listen! Error: ERR_BADAUTH

THENooBlet avatar Jun 05 '19 19:06 THENooBlet

if anybody can help me ive been trying for a month now to get bits info but im stuck

THENooBlet avatar Jun 05 '19 19:06 THENooBlet

Hi! so i was having this same issue for some weeks now. And finally I have made it work! The problem is that we're using the pubsub wrong. On the line with 'pubsub.SendTopics() method. We need to put the Oauth token of the streamer and not the bot. So yes, we'll need to have the streamer provide us an authentication token so our app can receive the events.

The example on the documentation seems to be using one account for the bot and the streamer. This have confused me for some time now.

Hope this helps. GL guys!

Honokii avatar Oct 17 '21 11:10 Honokii