TwitchLib / TwitchLib.Unity

TwitchLib repository representing all code belonging to the implementation of TwitchLib for Unity. Maintained primarily by LuckyNoS7evin.
164 stars 33 forks source link

Pubsub bad oauth #47

Open THENooBlet opened 5 years ago

THENooBlet commented 5 years ago

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 commented 5 years ago

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

Honokii commented 2 years ago

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!