Post

Craft Custom User Login Flows for Your App with Azure B2C

Struggling with limited control over user registration and login in your Azure B2C app? Custom policies are your key to unlocking complete customization! This guide empowers you to understand their purpose, navigate the Azure portal, explore starter packs, set up your tenant, and dive into hands-on tutorials. Learn how to create a “Hello World” policy, gather user input, and explore further examples to craft the perfect user journey for your app.

1. Understand the purpose of custom policy

Before you start working with custom policy, you need to understand that Azure B2C is one of the services of Azure cloud whose purpose is to manage user data related to your app or website which simplifies the user registration and login setup for you.

So this service also provides some pre-built forms for login, registration, profile, password change, etc. Now, these forms are called User Flows in Azure terminology.

You can directly integrate these Forms or User Flows in your app but you don’t have too much control over these forms or flows. In order to give you complete control over these user flows, Azure has included Customizable User Flows aka Custom Policy.

These custom policies are nothing but XML files where we can define our custom forms, change the look and feel or add more inputs as per the needs of your app’s login and registration flows.

2. Get familiar with Azure Portal

Now that you know what we are dealing with. Next step is to get familiar with the Azure Portal itself. Thankfully, you can create an account for free on Azure and start exploring various services like Azure AD B2C.

3. Get familiar with terminology

One thing I noticed while working with Azure is that the naming convention is too bad even for simple things which makes it difficult for new developers to understand some concepts which are otherwise straightforward once you start doing hands-on.

I have explained the terminology in detail in this post which you can refer to.

4. Download and explore Starter Pack xml files

Microsoft has provided a set of XML files which work as the base of all custom policies we are going to create.

You can refer this link to download the starter pack which is just a set of base XML files on top of which we are going to create our custom policies (custom flows).

Pro tip: Before you jump into writing your own custom policy, I will suggest you to open these starter pack xml files with your favourite editor and just explore them (even if nothing makes sense right now).

5. Setup your tenant for hands-on

Before you can deploy and test your custom policy, you need to follow some simple steps provided by Microsoft to setup your Azure tenant and app.

Follow the steps on this link and come back:-

  1. Create tenant here

  2. Register application here

6. Hands-on with hello world

Okay! So its time to deploy your first custom policy.

Refer this link for Hello World tutorial you were waiting for.

7. Hands-on with user input

Refer this tutorial where you learn how to take inputs.

8. Practice Practice Practice

Refer this table for more examples you can try.

Conclusion

These are the simple steps which you can follow to get started with Azure custom policies.

Don’t settle for generic user flows. Embrace the potential of Azure B2C custom policies to craft a unique and engaging login experience that reflects your brand and exceeds user expectations. Start your customization journey today and unlock a world of possibilities!

This post is licensed under CC BY 4.0 by the author.