Example for IHttpClientFactory typed client #1486
Hipster74
started this conversation in
Documentation Gaps
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, maybe I'm blind, but I can't find any examples how to use Microsoft.Identity.Web to get an accesstoken, add it to the Authorization header as a bearer token when using at .net core IHttpClientFactory typed httpclient?
About the typed client: Use IHttpClientFactory
My guess is that I should use a DelegatingHandler that with the help from MSAL.NET get an accesstoken from Azure(Client_Credentials grant) and adds it to the request in the authorization header? Sounds like the way to go, but I find no examples on that indicating that it is the wrong approach?
We should use the IHttpClientFactory they say, but examples does not incorporate authentication?
My scenario, I have a .NET Core worker service(practically a console app) that access datat from a Api protected with Azure AD Appregistration. So I need to get an accesstoken from Azure AD(Client Credentials flow) and add the accesstoken as a bearer token to the request to the api endpoint.
Beta Was this translation helpful? Give feedback.
All reactions