I am using AzureB2C with a number of dotnet6.0 WebApps and WebAPI applications. One of my WebApps calls two different WebAPIs, both of which are registered, along with their scopes, in AzureB2C. Typically, in my controller code, I inject the ITokenAcquisition component and call GetAccessTokenForUserAsync("[scopes]") to get an access token which I can then add to the HttpClient. This all works fine, but I would like to be a bit smarter and define the token acquisition in my Startup class as follows.
You can see that I want to define my HttpClient to use the extension method "AddMicrosoftIdentityUserAuthenticationHandler". There is very little documentation on this but there is a sample on GitHub here.
I would expect to inject my HttpFactory class into the Controller and create a client of type "auth_client". Microsoft Identity should then deal with acquiring the access token. I simply cannot get this to work.
Does anyone know if this works with Azure AD B2C or is it only designed to work against Azure AD?