Skip to content

Commit 6994eda

Browse files
fix: error message when changing credentials
Received error message: TwitchLib.Client.Exceptions.IllegalAssignmentException: While the client is connected, you are unable to change the connection credentials. Please disconnect first and then change them. Updating the code to only run the credential changes when there is an actual change. Disconnecting before we change the credentials.
1 parent b5e34a7 commit 6994eda

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ public static TwitchClientProxy Instance {
108108
public string? TwitchOAuthToken {
109109
get => _twitchOAuthToken;
110110
set {
111+
if (value == _twitchOAuthToken) {
112+
return;
113+
}
114+
111115
_twitchOAuthToken = value;
112116

113117
// If we have a client, try to connect.
114118
if (null != _client) {
119+
_client.Disconnect();
115120
_client.SetConnectionCredentials(new ConnectionCredentials(TwitchUsername, value));
116121
Connect();
117122
}

0 commit comments

Comments
 (0)