# Having trouble blocking SMS MFA

**URL:** <https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973>\
**Category:** Get Help\
**Tags:** phone-factor, mfa\
**Created:** [July 15, 2024, 10:17pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973 "2024-07-15T22:17:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harrison.hamill](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@harrison.hamill](https://community.auth0.com/u/harrison.hamill)\
**Post date:** [July 15, 2024, 10:17pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/1 "2024-07-15T22:17:04Z")

</div>

Hello,  
I’m attempting to block MFA SMS in specific scenarios, and experiencing an issue with both the built in Twilio integration and the native Auth0 dev SMS.

I’ve created a Send Phone Message action, and to test out my theory have used an extremely simple code like:

```auto
exports.onExecuteSendPhoneMessage = async (event, api) => {
   throw new Error("An error Message");
};

```

However when I attempt to login using an SMS MFA via New Universal Login, I still receive the message and don’t get any error either in the UI or logged.

I should note that I’m prompting in the first place using a separate Login action which uses api.authentication.challengeWith({type:‘phone’}) after detecting the enrolled mfa type(s).

Is there something I’m doing wrong, or something about this particular combination of actions thats causing this not to work? I’m modeling the error on [Enforce Unique Phone Number per User for SMS MFA](https://community.auth0.com/t/enforce-unique-phone-number-per-user-for-sms-mfa/117657).

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [July 19, 2024, 5:31pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/3 "2024-07-19T17:31:46Z")

</div>

Hi @harrison.hamill,

Welcome to the Auth0 Community!

Could you confirm if you are using a [custom phone provider](https://auth0.com/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-sms-voice-notifications-mfa#custom-phone-providers)?

If not, this is required to invoke the Send Phone Message Action.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![harrison.hamill](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@harrison.hamill](https://community.auth0.com/u/harrison.hamill)\
**Post date:** [July 19, 2024, 8:57pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/4 "2024-07-19T20:57:58Z")

</div>

Hi,  
I am not using custom phone provider - rather the native Twilio integration. Is there any way to invoke an action when using Twilio configuration?

Thanks!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [July 22, 2024, 5:31pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/5 "2024-07-22T17:31:28Z")

</div>

Hi @harrison.hamill,

Unfortunately, it is not possible. You must use a custom phone provider to send a phone message action. See the screenshot below:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/a/f/af79b8e9d4191a83a3987af723a871ccd4cb7345.png)

It might be worth considering adding an if-conditional statement in your post login action script to decide whether to call `api.authentication.challengeWith({type:'phone'})`. This way, you can block SMS MFA before it begins. You won’t be able to block it after it sends an SMS.

I hope this helps!

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![harrison.hamill](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@harrison.hamill](https://community.auth0.com/u/harrison.hamill)\
**Post date:** [July 24, 2024, 8:11pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/6 "2024-07-24T20:11:32Z")

</div>

Thanks I will look into if I can do it with a postlogin action.  
Do you know if there is any action I can use to inspect an SMS MFA enrollment? For example, I want to allow SMS MFA but need to show an error if the phone number entered is in a country that cant receive SMS. I assume the enrollment message also wont trigger the Send SMS Action if we are using native Twilio integration?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 7, 2024, 8:11pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/7 "2024-08-07T20:11:56Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 9, 2024, 6:10pm UTC](https://community.auth0.com/t/having-trouble-blocking-sms-mfa/138973/8 "2024-08-09T18:10:06Z")

</div>

Hi @harrison.hamill,

Thanks for the reply.

Unfortunately, it’s not possible to inspect an SMS MFA enrollment after it has begun.

There is a workaround mentioned [here](https://community.auth0.com/t/how-to-filter-or-lock-mfa-mobile-number-country-codes-in-new-universal-login/88800) on using the Classic Universal Login experience to allow a subset of the country codes.

Let us know if you have any additional questions.

Thanks,  
Rueben
