Skip to content

Commit c96f90d

Browse files
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. nullinside-development-group/nullinside-twitch-streaming-tools#20
1 parent b4247a8 commit c96f90d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class TwitchClientProxy : ITwitchClientProxy {
7373
/// </summary>
7474
private WebSocketClient? socket;
7575

76+
private string? _twitchOAuthToken;
77+
7678
/// <summary>
7779
/// Initializes a new instance of the <see cref="TwitchClientProxy" /> class.
7880
/// </summary>
@@ -103,7 +105,18 @@ public static TwitchClientProxy Instance {
103105
public string? TwitchUsername { get; set; }
104106

105107
/// <inheritdoc />
106-
public string? TwitchOAuthToken { get; set; }
108+
public string? TwitchOAuthToken {
109+
get => _twitchOAuthToken;
110+
set {
111+
_twitchOAuthToken = value;
112+
113+
// If we have a client, try to connect.
114+
if (null != client) {
115+
client.SetConnectionCredentials(new ConnectionCredentials(TwitchUsername, value));
116+
Connect();
117+
}
118+
}
119+
}
107120

108121
/// <inheritdoc />
109122
public void Dispose() {

0 commit comments

Comments
 (0)