Skip to content

Unaccounted for: :tmi.twitch.tv NOTICE * :Error logging in (please create a TwitchLib GitHub issue :P) #270

Description

@Tidlix

I'm working with TwitchLib the first time now but got an error, that tells me to create an GitHub issue so here I go.
What I did is creating a client and connecting it. However, the event handlers aren't working as they should. The only event that works correctly is the client.OnLog event, giving the following output:

Connecting to: wss://irc-ws.chat.twitch.tv:443
Should be connected!
Joining channel: tidlix
Received: :tmi.twitch.tv NOTICE * :Error logging in
Unaccounted for: :tmi.twitch.tv NOTICE * :Error logging in (please create a TwitchLib GitHub issue :P)
Unaccounted for: :tmi.twitch.tv NOTICE * :Error logging in (please create a TwitchLib GitHub issue :P)
Finished channel joining queue.
Received: :tmi.twitch.tv NOTICE * :Error logging in
Unaccounted for: :tmi.twitch.tv NOTICE * :Error logging in (please create a TwitchLib GitHub issue :P)
Unaccounted for: :tmi.twitch.tv NOTICE * :Error logging in (please create a TwitchLib GitHub issue :P)

Is this a bug from the Library, or did I something wrong? In case you need it, I'll post my Code below

client = new TwitchClient();
ConnectionCredentials credentials = new ConnectionCredentials("tidlix", Config.Twitch.accessToken);

client.Initialize(credentials, "tidlix");

client.OnLog += (s, e) =>
{
    Console.WriteLine(e.Data);
};
client.OnError += (s, e) =>
{
    Console.WriteLine(e.Exception);
};
client.OnConnected += (s, e) =>
{
    Console.WriteLine($"{e.BotUsername} connected!");
};

client.Connect();

I think I've also read somewhere that the token could be the problem so in case I've made something wrong there, thats how I get my token:

string destination = "https://id.twitch.tv/oauth2/token";
HttpClient client = new HttpClient();

var values = new Dictionary<string, string>
{
    {"client_id", Twitch.clientId},
    {"client_secret", Twitch.clientSecret },
    {"grant_type", "client_credentials" },
    {"scope", "chat:read chat:edit user:bot" }
};
var request = new FormUrlEncodedContent(values);

var response = await client.PostAsync(destination, request);
var responseString = await response.Content.ReadAsStringAsync();

var data = JsonConvert.DeserializeObject<tokenResponce>(responseString);
if (data != null)
{
    Twitch.accessToken = data.access_token;
}
else
{
    throw new Exception("Access Token request failed");
}

Thanks in advance for your help!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions