The Error "The phone number you provided is unreachable." in Azure AD B2C custom policy.

Harish Duppalapudi 0 Reputation points
2024-10-17T06:02:25.34+00:00

Hi Team,

I’m currently implementing Azure AD B2C authentication in a .NET 6 web app with embedded sign-in, including multi-factor authentication (MFA), using custom policies, and everything is working as expected.

However, during the phone number verification process, after clicking "Send Code" and then immediately and repeatedly clicking "Send a New Code," I received the error message "The phone number you provided is unreachable," as shown in the image below. The code was sent to the phone twice. Is this standard behavior, or can it be addressed?User's image

Here is the response of the verify API.User's image

Thanks in advance,

Harish D.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,068 questions
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 24,926 Reputation points Microsoft Employee
    2024-10-29T22:39:40.1533333+00:00

    Hi @Harish Duppalapudi , the behavior you're encountering where the phone number verification process results in an error after repeatedly clicking "Send a New Code" is generally a safeguard to prevent abuse or excessive requests, which can be seen as a form of rate limiting.

    In Azure AD B2C, there are built-in mechanisms to prevent abuse of the phone verification process, such as limiting the number of verification codes that can be sent in a short period. This helps to prevent potential denial-of-service attacks or abuse of the phone verification service.

    You could implement a countdown timer that disables the "Send a New Code" button for a certain duration after each request. For example:

    document.getElementById("sendNewCodeButton").addEventListener("click", function() {
        // Disable the button
        this.disabled = true;
        
    
    // Set a countdown timer (e.g., 30 seconds)
    let countdown = 30;
    let countdownElement = document.getElementById("countdown");
    countdownElement.textContent = `Please wait ${countdown} seconds before requesting a new code.`;
    
    let interval = setInterval(function() {
        countdown--;
        countdownElement.textContent = `Please wait ${countdown} seconds before requesting a new code.`;
    
        
        if (countdown === 0) {
            clearInterval(interval);
            countdownElement.textContent = "";
            document.getElementById("sendNewCodeButton").disabled = false;
        }
    }, 1000);
    });
    
    
    

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    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.