The repository for this article is located at https://github.com/mattruma/Auth0AzureADB2CMigrationDemo, where for the sake of this article, we will be working with the AzureADB2CWebApp project.
Now that we have our Azure AD B2C Tenant created we will need to update our
appsettings.Development.json file, which we will need to add as it is not included in the repository.
Navigate to the Azure AD B2C tenant and copy the Domain name, then update the
AzureADB2C:Domain setting in the
Next, click on Applications and then click on the AzureADB2CWebApp application.
appsettings.Development.json file update the value of
AzureADB2C:ClientId with the
Application ID of the application.
We will need to generate a Key for the
AzureADB2C:ClientSecret setting. To do this, click on Keys, then click Generate key.
One thing to note, sometimes the generated key includes some characters that need to be escaped, I usually just regenerate the key until a get a key that does not need to be escaped, my choice, might not be yours.
Copy the displayed value and update
AzureADB2C:ClientSecret in the
You will also need to provide a
The reason this is needed is that Azure AD B2C requires the policy to be passed as the query string parameter
p and the URL that is normally created does not include this parameter.
MetaAddress will look like
That’s it! You are now ready to test your application!
Run the AzureADB2CWebApp application from Visual Studio.
Click Sign up now to create a new account.
You will need to provide an Email Address and then click Send verification code.
When you receive the email, which is pretty fast, copy the verification code.
Enter, or paste, your verify code and then click click click Verify Code, once the code is verified you will be able to complete the sign up process.
Click on Claims, the page that requires authentication, and you will now see a list of claims, a little different than Auth0 as far as the type goes, but otherwise the same data.
Migrating from Auth0 to Azure AD B2C took me longer than I would like to admit to get this all working. The documentation for Azure AD B2C is immature compared to that of Auth0 which presented the greatest challenge.
If this series of articles helped you out, let me know! I like knowing I gave a fellow developers a few hours or few days of their life back!