dotnet-jwt-token-manager/OpenHarbor.JwtTokenManager.Abstractions/HttpClientExtensions.cs

12 lines
392 B
C#
Raw Permalink Normal View History

using System.Net.Http.Headers;
namespace OpenHarbor.JwtTokenManager.Abstractions;
public static class HttpClientExtensions
{
public static HttpClient SetJwtAccessToken(this HttpClient httpClient, JwtTokenManagerResult token)
{
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(token.TokenType.ToString(), token.AccessToken);
return httpClient;
}
}