Skip to content

Commit 122bee4

Browse files
Merge pull request #92 from nullinside-development-group/fix/login
fix: twitch client not receiving updated credentials
2 parents b4247a8 + ca4d4e9 commit 122bee4

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)