From 26bac92e5a71b1f52f84e1800bf360e91304a9b8 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Mon, 30 Dec 2024 14:24:28 +1100 Subject: [PATCH] qol: online services authentication expiration offset --- .../Interop/DiscoServices/OnlineServicesAuthentication.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Disco.Services/Interop/DiscoServices/OnlineServicesAuthentication.cs b/Disco.Services/Interop/DiscoServices/OnlineServicesAuthentication.cs index 313c81c5..7032b593 100644 --- a/Disco.Services/Interop/DiscoServices/OnlineServicesAuthentication.cs +++ b/Disco.Services/Interop/DiscoServices/OnlineServicesAuthentication.cs @@ -58,7 +58,7 @@ namespace Disco.Services.Interop.DiscoServices using (var httpClient = new HttpClient()) { - httpClient.BaseAddress = new Uri(ActivationService.baseUrl); + httpClient.BaseAddress = ActivationService.BaseUrl; httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var timeStamp = DateTime.UtcNow.ToUnixEpoc(); @@ -105,7 +105,7 @@ namespace Disco.Services.Interop.DiscoServices throw new InvalidOperationException($"Failed to authenticate ({authResponse.ErrorMessage})"); token = authResponse.Token; - tokenExpires = DateTimeExtensions.FromUnixEpoc(authResponse.Expiry.Value).AddMinutes(-5); + tokenExpires = DateTime.Now.AddSeconds(authResponse.ExpiresInSeconds.Value); return token; } @@ -160,7 +160,7 @@ namespace Disco.Services.Interop.DiscoServices { public bool Success { get; set; } public string Token { get; set; } - public long? Expiry { get; set; } + public int? ExpiresInSeconds { get; set; } public string ErrorMessage { get; set; } } }