From ca4d4e991bf509092ed21b3a3abc965fab6c3d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Wed, 11 Jun 2025 21:43:17 -0400 Subject: [PATCH] fix: twitch client not receiving updated credentials If the credentials needed to change (not be set for the first time but actually change from one value to another), their value wasn't being pushed to the underlying client. We now pass the credentials to the same place as the initialization. closes nullinside-development-group/twitch-streaming-tools#20 --- .../Twitch/TwitchClientProxy.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs b/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs index 70e8aa2..b25db58 100644 --- a/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs +++ b/src/Nullinside.Api.Common/Twitch/TwitchClientProxy.cs @@ -73,6 +73,8 @@ public class TwitchClientProxy : ITwitchClientProxy { /// private WebSocketClient? socket; + private string? _twitchOAuthToken; + /// /// Initializes a new instance of the class. /// @@ -103,7 +105,18 @@ public static TwitchClientProxy Instance { public string? TwitchUsername { get; set; } /// - public string? TwitchOAuthToken { get; set; } + public string? TwitchOAuthToken { + get => _twitchOAuthToken; + set { + _twitchOAuthToken = value; + + // If we have a client, try to connect. + if (null != client) { + client.SetConnectionCredentials(new ConnectionCredentials(TwitchUsername, value)); + Connect(); + } + } + } /// public void Dispose() {