Implementing AD B2C custom policy with separation of email entering and sign-in sign-up steps

Viewed 58

I'm trying to implement custom AD B2C policy which should work in the following way: First, user lands on screen with email field, he enters his email and clicks on "Next" button. Then, if user with entered email is already exists in local directory he is redirected to page to enter his password, if email does not exist in local directory - he should be redirected to sign up page with pre-populated email.

I'm looking for some examples or advices on where to start for implementing such policy

1 Answers

You can do this with a self-asserted page that asks for an email address.

Then do a "AAD-UserReadUsingEmailAddress".

Set "RaiseErrorIfClaimsPrincipalDoesNotExist" to false.

If you get an objectID, then do a "LocalAccountWritePasswordUsingObjectId".

Note this is not secure since anyone guessing an email address could change their password.

If there is no objectID, then do a normal signup flow with the email address as an input claim so it will be pre-populated.

Example here.

Related