The POCCreates a new Console project and then add Microsoft.IdentityModel.Clients.ActiveDirectory package.
Now add this class to your project
We will use the implementation of HttpMessageHandler for the pipeline of the instance of HttpClient we will use to access to our API.
The HtppMessageHandler needs three parameters: AuthenticationContext, ClientCredential and appIDUri. To create each one we needs some information we have seen in the previous post and to be consistent I will reuse the same images.
The AuthenticationContextTo create an instance of the AuthenticationContext we need only the URL of the AAD where our API-app and our client are registered. It should look something like this:
The ClientCredentialTo create an instance of ClientCredential we need the “Application ID” and the “Key” of our client registered un our AAD:
the Application ID is
the key is