Search code examples
azureazure-active-directoryazure-ad-b2cazure-ad-msalhello.js

SPA + WebAPI authenticate using Azure AD B2C and Azure AD


My customer wants to use AZURE AD B2C to authenticate external users, and Azure AD for employees of his company. I've been looking on github and googling about it, but there's a lack of examples over there.

Does anybody had the same requirement to give some hints?

Besides that, it seems that MSAL.js / hello.js has some bugs (X-Frame-Options issue when renewing the token).

Is there any other JS library that I'm not familiar?


Solution

  • My customer wants to use AZURE AD B2C to authenticate external users, and Azure AD for employees of his company.

    Azure B2C supports this from custom policies. You can easily configure this by referring Azure Active Directory B2C: Get started with custom policies and Azure Active Directory B2C: Sign in by using Azure AD accounts

    Besides that, it seems that MSAL.js / hello.js has some bugs (X-Frame-Options issue when renewing the token).

    Microsoft was written a sample application using hello.js library. But as you said it has x-frame options issue but that is only for Social IDPs. So, you can still use SPA app written from Microsoft for your use-case.

    Is there any other JS library that I'm not familiar?

    Yes, there is another JS library out there similar to hello.js that is oidc-client.js. It is easy to configure and use in SPA application.