Fix refreshing Nexus OAuth token not working properly

This commit is contained in:
tr4wzified 2024-05-30 00:28:28 +02:00
parent 6dde81ec7c
commit 84f393a68a

View File

@ -273,6 +273,8 @@ public class NexusApi
var response = await _client.PostAsync($"https://users.nexusmods.com/oauth/token", content, cancel); var response = await _client.PostAsync($"https://users.nexusmods.com/oauth/token", content, cancel);
var responseString = await response.Content.ReadAsStringAsync(cancel); var responseString = await response.Content.ReadAsStringAsync(cancel);
var newJwt = JsonSerializer.Deserialize<JwtTokenReply>(responseString); var newJwt = JsonSerializer.Deserialize<JwtTokenReply>(responseString);
if (newJwt != null)
newJwt.ReceivedAt = DateTime.UtcNow.ToFileTimeUtc();
state.OAuth = newJwt; state.OAuth = newJwt;
await AuthInfo.SetToken(state); await AuthInfo.SetToken(state);