I’m creating a class library (.NET Standard 2) where I need to pass a HttpClient to the constructor (Dependency Injection).
The class library is calling a third-party API using OAuth2 (It requests their API – with ClientID and ClientSecret – and get a token back which I’m going to use for subsequent calls).
I have some problems figuring out how to do the OAuth2 “stuff” with dependency injection.
The project I’m using the class library in – sets up the dependency in the StartUp class like: Services.AddHttpClient()
Can I somehow attach the OAuth2 “stuff” to the HttpClient?