protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var tokenPairResult = await _tokenClient.AcquireTokenPairAsync(cancellationToken); if (tokenPairResult.IsFailure) { return(new HttpResponseMessage(HttpStatusCode.Unauthorized)); } request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", tokenPairResult.Value.AccessToken); return(await base.SendAsync(request, cancellationToken)); }