How to make authenticated requests to an ASP.NET Core web API using IdentityServer4 with Client Credentials.
This is a guide on how to make requests to a protected resource using Client Credentials with the IdentityServer4.Contrib.HttpClientService nuget package. The library is actually an
HttpClient service that makes it easy to make authenticated and resilient HTTP requests to protected by IdentityServer4 resources. Additionally, more features include automatic complex type serialization for requests / deserialization for responds (using
Json.NET), caching of the token response to reduce load and an
HttpRequestMessage factory that adds an “
X-HttpClientService” header for logging/tracking between cascading API calls.