Azure AD B2C Password reset does not work when the users are created using the graph API and Sign In Name as Username

Viewed 420

I am using Azure AD B2C with Username login for my application. I am creating,updating and deleting users using the graph API and there is no way of adding a primary email programatically (I can only add the "OtherMail" property in the graph api) so as to later use it in the password reset policy for verification. So now I have no way of resetting the password using my password reset policy.

Any pointers would be helpful.

1 Answers

You can read/write the user's Email address using strongAuthenticationEmailAddress attribute within the B2C policy. This attribute can only be read or written to by the B2C policy execution.

Typically, at user sign-in, you will read strongAuthenticationEmailAddress and then check if it is empty. If it is, then ask the user to input/verify Email address before proceeding further to the next orchestration step.

Take a look at this sample to get started:

https://github.com/azure-ad-b2c/samples/tree/master/policies/username-signup-or-signin

Related