IHttpClientFactoryacts a little weired. I wrote a generic auth system so I can use different mechanisms across different Blazor apps. While implementing an OAuth / IdentityModel provider I gave up on the
IHttpClientFactory. I have a generic
DelegatingHandlerwhich handles HTTP authorization based on the users auth scheme. Therefore it needs to have access to other services which provide the actual authorization implementation and data. Long story short: Somewhere in the pipeline the
IHttpClientFactorycreates a new DI scope in which the
DelegatingHandlerprocesses the request and there is - to my knowledge - no way to access the users auth data within the users „main“ scope. Keep that in mind in case you want to implement something more complex.