From 560f562205b802019f173ed6ce5ca96d21418ffb Mon Sep 17 00:00:00 2001 From: DavidGudEnough Date: Mon, 17 Mar 2025 10:35:18 -0400 Subject: [PATCH] fix iscredentialsinheader reverse condition --- OpenHarbor.JwtTokenManager/JwtTokenManagerService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenHarbor.JwtTokenManager/JwtTokenManagerService.cs b/OpenHarbor.JwtTokenManager/JwtTokenManagerService.cs index f400758..d6b919c 100644 --- a/OpenHarbor.JwtTokenManager/JwtTokenManagerService.cs +++ b/OpenHarbor.JwtTokenManager/JwtTokenManagerService.cs @@ -31,7 +31,7 @@ public class JwtTokenManagerService(JwtTokenManagerOptions options, IHttpClientF new ("scopes", string.Join(" ", _scopes)) }; - if (options.IsCredentialsInHeader) + if (false == options.IsCredentialsInHeader) { formContentKeyValues.AddRange([ new KeyValuePair("client_id", options.ClientId), @@ -45,8 +45,9 @@ public class JwtTokenManagerService(JwtTokenManagerOptions options, IHttpClientF Content = formContent }; - if (false == options.IsCredentialsInHeader) + if (options.IsCredentialsInHeader) { + var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{options.ClientId}:{options.ClientSecret}")); request.Headers.Authorization = new AuthenticationHeaderValue("Basic", credentials); }