Azure B2C - Single App with multiple login for different user types setup in Azure

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Azure B2C - Single App with multiple login for different user types setup in Azure



I'm building an ASP.Net core app. I have two types of users, the Consumers and the Vendors.
How can I in Azure AD B2C setup TWO different Signup/Signin for my two different types of users? So in my ASP I can have a page for consumers to signup using third party providers and a page for vendors to signup with email/password and other data.
In this case, will azure keep these users separately? How will I know when I get a Token what type of user has logged in?



Thank you in advance!
..Ben




1 Answer
1



You can have two different Sign-in policies, one for the Vendors and the other for Consumers. At the least, Tthe framework returns a "tpf" claim (Trust Framework Policy) which contains the name of the policy itself.



So, you can check for this claim on the client and distinguish the user type accordingly.



Sign-in policies



auth response:



enter image description here



Another approach would be adding a Custom user attribute to the Sign-in policy which will be available upon signup. Include the custom attribute in sign-in policy to be added in the Sign-up form and returned in claims. Restrict the user to entering the value of the custom attribute by modifying the Page UI. Change the field type for the custom attribute as "dropdownsingleselect" and provide one static value as "vendor". (the same can be done for the second sign-in policy with a value as "consumer").



enter image description hereenter image description here



As the user signs-up, you can see the custom attribute will be returned in claims.



enter image description here



Hope that helps!





Thank you Sunny for the detail answer. I was thinking of going with the Custom UI route but wasn't sure I have the dropdown option. Thank you again.
– Ben Hayat
Aug 9 at 4:19






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard