question

Gray-0005 avatar image
0 Votes"
Gray-0005 asked vipulsparsh-MSFT answered

Azure Active Directory and Web API authentication

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

azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

vipulsparsh-MSFT avatar image
1 Vote"
vipulsparsh-MSFT answered

@Gray-0005 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.



image.png (168.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.