azure-ad-b2cazure-ad-b2c-custom-policy

How do add device management to TOTP custom B2C policy?


I've been able to get this sample custom policy working on my B2C tenant. However, once a user signs-up with the authenticator app the first time, there doesn't seem to be a way to add a new device (or delete their existing device to re-register).

How do I change the code to allow for adding additional devices.


Solution

  • As the code stands, you can't.

    This is because the code uses "numberOfAvailableDevices" = 0 to allow you to sign up and "numberOfAvailableDevices" > 0 to ask for the code.

    You need to copy the policy and make another policy just for further sign-up and then reference that somehow in your app or elsewhere. This policy won't check for the number of devices.

    You could use this policy as a guide to add another button/link to the page to do this. It adds forgotten password as a button/link and then sets a flag to show this option was selected.

    To delete a device, you need this API.