Search code examples
.netauthenticationazure-ad-b2cmsal.jsmsal-react

Which application should I register in Azure Active Directory B2C?


I am starting to develop a project where I am planning to use Azure AD B2C for Identity service to provide and handle authentication, Facebook login, .NET for my Web API, probably React or Vue for front-end, and Microsoft SQL for the database.

My question is, should I register both my front-end (React or Vue) and .NET Web API in Azure AD B2C?

In this Microsoft tutorial: https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-applications?tabs=app-reg-ga there are separate tutorial page for registering SPA, and web apps or API's. Also, there is also msal for general SPA's, msal-react for React specific SPA's.

Can someone help me understand or clarifies what should I register? Should I register the one over the other, or should I register both? Also, is it much better to use msal-react when using React?

I am still in the researching and design phase.


Solution

  • Yes, you should have an app. registration for each = 2 app. registrations.

    Then give the web. app permission to access the API.

    In terms of libraries, the msal libraries do a lot under the covers e.g. token management, refresh tokens etc.