Azure Active Directory and Web API authentication

Gray 21 Reputation points
2021-07-28T21:43:09.13+00:00

I've watched this tutorial video:

https://www.youtube.com/watch?v=3PyUjOmuFic&t=15s

My question is, how does the client know that it needs to go to AAD to get the token, when the web API code doesn't sit in Azure?
When the web api and the client project (both in Visual Studio) were registered in Azure, are the IDs (tenant id, resource Id, etc) the only ones needed to for the client to go to Azure, grab the token even before hitting the running web api?
Is this all what's needed to make azure the mediator between web api and the client?

Can you please point me to the right direction to understand authentication using Azure.

Thanks

Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. VipulSparsh-MSFT 16,311 Reputation points Microsoft Employee
    2021-07-29T07:07:31.757+00:00

    @Gray Thanks for reaching out.

    Yes its as simple as it gets in that video. Microsoft has already built Authentication libraries which enable developers to acquire tokens from MS identity platform endpoint.
    You can use https://www.nuget.org/packages/Microsoft.Identity.Web/0.1.1-preview MS identity web package to get this all as inbuilt feature without having to code any custom code for getting tokens from AAD.

    You can read about MSAL (Microsoft Authentication Library ) here.

    Microsoft Identity Web is a library which contains a set of reusable classes used in conjunction with ASP .NET Core for integrating with the Microsoft identity platform (formerly Azure AD v2.0 endpoint) and AAD B2C.
    Microsoft Identity Web also leverages Microsoft Authentication Library (MSAL), which will fetch the tokens and provides token cache extensibility.

    This should give you more information about Microsoft Identity platform (must read) :

    118920-image.png

    -----------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.