IHttpClientFactory is a dependency-injection service for creating named HttpClient instances with configured handler chains. Register each client with AddHttpClient, then request the required client by name where it is needed. section 8.3.3
A typical setup follows these steps:
- Install or use Microsoft.Extensions.Http and register clients in the services collection with AddHttpClient. section 8.3.3
- Give each client a unique name when clients serve different purposes. section 8.3.3
- Register delegating handlers and attach them to the appropriate client’s handler chain. section 8.3.3
- Inject IHttpClientFactory and call CreateClient with the required name. section 8.3.3
Authenticated API client
Register AuthHandler, then configure a client named AuthHandler.AUTHENTICATED_CLIENT with that handler. A BaseService can inject IHttpClientFactory and create the named client; requests made through it automatically receive the access-token header. section 8.3.3 section 8.5

