Skip to content

Commit 1e243e4

Browse files
Merge pull request #110 from nullinside-development-group/chore/update
chore: update
2 parents 6a1a737 + 222fce9 commit 1e243e4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Nullinside.Api.TwitchBot/Controllers/LoginController.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Nullinside.Api.Model;
99
using Nullinside.Api.Model.Shared;
1010

11+
using TwitchLib.Api.Helix.Models.Users.GetUsers;
12+
1113
namespace Nullinside.Api.TwitchBot.Controllers;
1214

1315
/// <summary>
@@ -68,13 +70,13 @@ public async Task<IActionResult> TwitchLogin([FromQuery] string code, [FromServi
6870
return Redirect($"{siteUrl}/twitch-bot/config?error={TwitchBotLoginErrors.TWITCH_ACCOUNT_HAS_NO_EMAIL}");
6971
}
7072

71-
(string? id, string? username) user = await api.GetUser(token);
72-
if (string.IsNullOrWhiteSpace(user.username) || string.IsNullOrWhiteSpace(user.id)) {
73+
User? user = await api.GetUser(token);
74+
if (string.IsNullOrWhiteSpace(user?.Login) || string.IsNullOrWhiteSpace(user.Id)) {
7375
return Redirect($"{siteUrl}/twitch-bot/config?error={TwitchBotLoginErrors.INTERNAL_ERROR}");
7476
}
7577

7678
string? bearerToken = await UserHelpers.GenerateTokenAndSaveToDatabase(_dbContext, email, token, api.OAuth?.AccessToken,
77-
api.OAuth?.RefreshToken, api.OAuth?.ExpiresUtc, user.username, user.id);
79+
api.OAuth?.RefreshToken, api.OAuth?.ExpiresUtc, user.Login, user.Id);
7880
if (string.IsNullOrWhiteSpace(bearerToken)) {
7981
return Redirect($"{siteUrl}/twitch-bot/config?error={TwitchBotLoginErrors.INTERNAL_ERROR}");
8082
}

0 commit comments

Comments
 (0)