19 lines
641 B
C#
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);
|
|
}
|
|
}
|
|
}
|