From 057f8005702e4f1b3f2ffc4dd0d86ccc66115229 Mon Sep 17 00:00:00 2001 From: Philip Gichuhi Date: Wed, 30 Oct 2024 10:40:41 +0200 Subject: [PATCH] Change additional auth context type and log at appropriate step --- src/http/httpClient/Middleware/AuthorizationHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http/httpClient/Middleware/AuthorizationHandler.cs b/src/http/httpClient/Middleware/AuthorizationHandler.cs index 6eb3ef9..4716b3c 100644 --- a/src/http/httpClient/Middleware/AuthorizationHandler.cs +++ b/src/http/httpClient/Middleware/AuthorizationHandler.cs @@ -85,7 +85,7 @@ protected override async Task SendAsync(HttpRequestMessage } private async Task AuthenticateRequestAsync(HttpRequestMessage request, - Dictionary? additionalAuthenticationContext, + Dictionary additionalAuthenticationContext, CancellationToken cancellationToken, Activity? activityForAttributes) { @@ -98,8 +98,8 @@ private async Task AuthenticateRequestAsync(HttpRequestMessage request, var accessToken = await accessTokenProvider.GetAuthorizationTokenAsync( request.RequestUri, additionalAuthenticationContext, cancellationToken).ConfigureAwait(false); - if(string.IsNullOrEmpty(accessToken)) return; activityForAttributes?.SetTag("com.microsoft.kiota.handler.authorization.token_obtained", true); + if(string.IsNullOrEmpty(accessToken)) return; request.Headers.TryAddWithoutValidation(AuthorizationHeader, $"Bearer {accessToken}"); } }