Files
Disco/Disco.Services/Interop/DiscoServices/OnlineServicesAuthenticatedHandler.cs
T
2025-06-15 17:56:13 +10:00

19 lines
641 B
C#

using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace Disco.Services.Interop.DiscoServices
{
internal class OnlineServicesAuthenticatedHandler : HttpClientHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var token = await OnlineServicesAuthentication.GetTokenAsync();
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
return await base.SendAsync(request, cancellationToken);
}
}
}