1
votes

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

1 Answers

1
votes

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 here enter 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!