Azure AD B2C Custom OTP Verification Unable to Add Send New Code Button/Link

Evan Levy 20 Reputation points
2024-12-04T17:20:30.1066667+00:00

I have an Azure AD B2C custom policy with email and phone SMS OTP verification for MFA purposes in which I am not using the out-of-the-box custom policy from Microsoft so that codes are sent automatically without a first screen to click the Send Code button to lessen number of clicks. This basically has split out the generate/send OTP step and the verify OTP step.

The issue is that I no longer have the "send a new code" link/button to request a new OTP code sent to email/phone after the initial one is sent. I have been unable to figure out a custom solution that will work. My goal is to add a resend code functionality to my split out steps for both email and phone verification rather than go back to the out-of-the-box solution.

Before splitting out the steps for email verification, I had a working JavaScript solution that would automatically click the send code button to get to the verification step and additionally skip the continue button step after verifying, but it was clunky and somewhat visible to the end user what was happening. I also need to keep this split step approach for the phone SMS OTP verification for other reasons and would like the email and phone verification to mirror each other for consistency.

I do not believe there is a way to repeat the current orchestration step (i.e., initially generate/send/verify otp > user clicks custom send new code link > skip verify otp validation technical profile and repeat the current orchestration step to generate/send/verify otp > once user clicks the verify code button to continue, run validation technical profile to verify otp and move to next orchestration step).

Any suggestions? Happy to provide more details as needed.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Givary-MSFT 35,621 Reputation points Microsoft Employee Moderator
    2024-12-10T05:54:15.09+00:00

    @Evan Levy I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: have an Azure AD B2C custom policy with email and phone SMS OTP verification for MFA purposes in which I am not using the out-of-the-box custom policy from Microsoft so that codes are sent automatically without a first screen to click the Send Code button to lessen number of clicks. This basically has split out the generate/send OTP step and the verify OTP step.

    The issue is that I no longer have the "send a new code" link/button to request a new OTP code sent to email/phone after the initial one is sent. I have been unable to figure out a custom solution that will work. My goal is to add a resend code functionality to my split out steps for both email and phone verification rather than go back to the out-of-the-box solution.

    Before splitting out the steps for email verification, I had a working JavaScript solution that would automatically click the send code button to get to the verification step and additionally skip the continue button step after verifying, but it was clunky and somewhat visible to the end user what was happening. I also need to keep this split step approach for the phone SMS OTP verification for other reasons and would like the email and phone verification to mirror each other for consistency.

    I do not believe there is a way to repeat the current orchestration step (i.e., initially generate/send/verify otp > user clicks custom send new code link > skip verify otp validation technical profile and repeat the current orchestration step to generate/send/verify otp > once user clicks the verify code button to continue, run validation technical profile to verify otp and move to next orchestration step).

    Resolved by @Evan Levy and below comment has the detailed steps which were followed.

    If you have any other questions or are still running into more issues, please let me know. Thank you again for your time and patience throughout this issue.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


1 additional answer

Sort by: Most helpful
  1. Navya 19,875 Reputation points Microsoft External Staff Moderator
    2024-12-09T19:00:47.92+00:00

    Hi @Evan Levy

    Thank you for posting this in Microsoft Q&A.

    I understand you have an Azure AD B2C custom policy with email and phone SMS OTP verification for MFA purposes, and you have split out the generate/send OTP step and the verify OTP step. However, you are facing an issue where you no longer have the "send a new code" link/button to request a new OTP code sent to email/phone after the initial one is sent. You are looking for a custom solution to add a resend code functionality to your split out steps for both email and phone verification.

    One possible solution is to create a new orchestration step that generates and sends a new OTP code, and then redirects the user back to the verification step. You can then add a custom link or button on the verification page that triggers this new orchestration step.

    To implement this solution, you can follow these steps:

    1. Create a new orchestration step that generates and sends a new OTP code. You can use the same technical profile that you are currently using to generate and send the initial OTP code.
    2. Add a new claims transformation that sets a flag indicating that a new OTP code has been sent. You can use a boolean claim type for this flag.
    3. Modify the verification orchestration step to check for the flag indicating that a new OTP code has been sent. If the flag is set, skip the validation technical profile and redirect the user back to the new orchestration step to generate and send a new OTP code.
    4. Add a custom link or button on the verification page that triggers the new orchestration step to generate and send a new OTP code. You can use JavaScript to set the flag indicating that a new OTP code has been sent and then submit the form to trigger the new orchestration step.

    Hope this helps. Do let us know if you any further queries.

    Thanks,

    Navya.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.