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