handles
handles

Reputation: 7863

Can I reuse an existing HttpClient client with AspNetCore.HealthChecks.Uris

I'd like to add a Health Check for an API using AspNetCore.HealthChecks.Uris. Unfortunately, the endpoint that I need to hit requires auth, so the HttpClient that is used for this API is added like:

services.Configure<SomeCustomCredentialsType>("someName", options =>
{
    options.TokenEndpoint = "someUrl";
    options.ClientId = "someId"
    options.ClientSecret = "someSecret"
    options.Scope = "someScope"
});

services.AddClientCredentialsHttpClient("someName", ...)

Is there away that I can use HealthCheckBuilder to add a Uri health check that would use these same credentials? Maybe by reusing the same HttpClient? Or is there another way to achieve the same thing?

Upvotes: 0

Views: 56

Answers (1)

handles
handles

Reputation: 7863

Turns out I can hit an endpoint without Authentication on this particular 3rd party service. They have a "/ping" endpoint.

Upvotes: 0

Related Questions