We are using a user flow to sign up & sign in users to our application. An important thing to point out is that a single Azure B2C user can represent accounts under different tenants/customers in our app.
e.g. Azure B2C user [email protected] should be able to login to both customer1/app and customer2/app with their email.
Consider
- [email protected] registers under customer1
- some time later, they attempt to create an account for customer2
- by default, if they use their email [email protected], they will get back a duplicate email error.
What we’d like to do is to first check if our Azure B2C tenant already has the provided email registered and if so, redirect that user to the log in page.
Since I didn’t manage to find such a scenario documented, the one potential solution I considered is using “Before creating the user” API Connector
The flow as I envision it then is
- [email protected] registers under customer1
- some time later, they attempt to create an account for customer2
- API connector’s endpoint is hit, detecting an already registered user
- At this point, we’d redirect the user to the sign-in page, asking them to log in in their existing account.
Is an API Connector the right tool for the job, is there an alternative approach? I really want to avoid writing custom policies.
I know we can also have an Azure B2C tenant for each customer, but that’s also something that I’d prefer to avoid, because it would be a real pain to maintain.