Skip to content

Commit effe8aa

Browse files
Updating chat client with new OAuth token after refresh
Assuming the rest of the code is behaving properly, in terms of knowing whether or not the chat client is connected, simply updating the token should keep up connected.
1 parent d325c3e commit effe8aa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Nullinside.Api.TwitchBot/Services/MainService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) {
162162

163163
ITwitchApiProxy? botApi = await db.ConfigureApiAndRefreshToken(botUser, this._api, stoppingToken);
164164
if (null != botApi) {
165+
// Ensure the twitch client has the most up-to-date password
166+
this._client.TwitchOAuthToken = botApi.OAuth?.AccessToken;
167+
165168
// Trim channels that aren't live
166169
IEnumerable<string> liveUsers = await botApi.GetChannelsLive(usersWithBotEnabled
167170
.Where(u => null != u.TwitchId)

0 commit comments

Comments
 (0)