DEV Community

Discussion on: How to Configure Azure AD B2C Authentication with Next.js

Collapse
 
benjaminwfox profile image
Ben Fox

Hey David! Sorry for the late response, I didn't get an outside notification. Did you find an answer for this?

Multiple policies are possible - in a tenant I have I've used both the basic, built-in user flows and two different sets of custom policies. I'm not sure if there is a limit, but as long as the policies are named differently you should be able to upload as needed.

The key is pointing the user to the correct policy for sign-in.

Collapse
 
dmendozaamu profile image
David Mendoza

Do you happen to know of any code examples that you might direct me to?

Thread Thread
 
benjaminwfox profile image
Ben Fox • Edited

Unfortunately I don't have a comprehensive example, all my B2C code exists in a private repo.

I can provide some ideas, which maybe will help? In my B2C Tenant I have different policies uploaded and organized by a prefix: showing uploaded B2C custom policy names.

Then the custom policies just have unique names - so I have the two different base policy PolicyIds:

  • B2C_1A_SocLoc_TrustFrameworkBase
  • B2C_1A_InviteMeta_TrustFrameworkBase

Essentially creating two different policy "collections" - these policies are both copied from the Starter Pack.

And all of the additional custom policy files then (Localization, Extensions, SignUpOrSignin, PasswordReset, etc...) just need to have their BasePolicy updated to point to the renamed Base

For instance, my InviteMeta-TrustFrameworkLocalization.xml has this:

  <BasePolicy>
    <TenantId>xxxxxxxxxxxxxx.onmicrosoft.com</TenantId>
    <PolicyId>B2C_1A_InviteMeta_TrustFrameworkBase</PolicyId>
  </BasePolicy>
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
benjaminwfox profile image
Ben Fox

Oops, fixed the image that I uploaded but didn't include.