Open Closed

Phone verification is available even if Twilio is not enabled #8590


User avatar
0
Navneet@aol.com.au created

Check the docs before asking a question: https://abp.io/docs/latest Check the samples to see the basic tasks: https://abp.io/docs/latest/samples The exact solution to your question may have been answered before, and please first use the search on the homepage. Provide us with the following info: 🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration button.

  • ABP Framework version: vX.X.X
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello Team,

  1. One of my Tenant's users was complaining that Phone verification is not working, upon checking, I never installed it in my project, but the application is still giving the option to verify the phone number, please see the screenshot below:-

Is there any way I can check if Twilio is not enabled, and doesn't show a phone verification option?

  1. Also, my tenant is now interested in activating Twilio, but upon checking it is a costly option, 20 SMS for $1, I am thinking of creating a Tenant based Twilio setting management, so that any tenant interested, Tenant can put their own Twilio credentials and use it, Is there any way can I use the same example of Ticket #8552 to get and set from MyTwilioService similar to CORS suggestions:
context.Services.RemoveAll(typeof(ICorsPolicyProvider));
context.Services.Add(ServiceDescriptor.Transient<ICorsPolicyProvider, MyCorsPolicyProvider>());


public class MyCorsPolicyProvider : ICorsPolicyProvider
{

Thanks, Navneet

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is there any way I can check if Twilio is not enabled, and doesn't show a phone verification option?

    You can inject the ISmsSender and check the instance if a TwilioSmsSender.


    You can set IdentitySettingNames.SignIn.EnablePhoneNumberConfirmation to false for specific tenants.

    Setting under Identity setting area.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Navneet@aol.com.au created

    hi

    Is there any way I can check if Twilio is not enabled, and doesn't show a phone verification option?

    You can inject the ISmsSender and check the instance if a TwilioSmsSender.


    You can set IdentitySettingNames.SignIn.EnablePhoneNumberConfirmation to false for specific tenants.

    Setting under Identity setting area.

    Thanks,

    I have found the class AbpIdentitySettingDefinitionProvider under Volo.Abp.Identity.Domain, however which service (or where can I find the file) is responsible for getting and setting this?

    To extend the functionality of setting Twilio settings for each Tenant, I have looked at the class TwilioSmsSender.cs, the code with set the credentials has "lock (syncLock)" What is this for?

    Do you see any issue if I reinitialise "TwilioClient.Init()" every time the application tries to send an SMS?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can get/set settings by ISettingManager

    SetForTenantAsync
    

    It seems the TwilioClient is designed to init once(ALL method are static).

    You can override TwilioSmsSender to create the TwilioRestClient

    https://github.com/twilio/twilio-csharp/blob/95cc216f8e7353e373fdcaf7e8a0432e28b183b6/src/Twilio/Rest/Api/V2010/Account/MessageResource.cs#L156-L161

    https://github.com/twilio/twilio-csharp/blob/95cc216f8e7353e373fdcaf7e8a0432e28b183b6/src/Twilio/Rest/Api/V2010/Account/MessageResource.cs#L134-L150

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Navneet@aol.com.au created

    Hi Maliming,

    Thanks for sharing resources, I will try to integrate them.

    Sorry for asking again, I have found the class AbpIdentitySettingDefinitionProvider under Volo.Abp.Identity.Domain. Where can I find the file that contains the implementation of Get and Set to/from SettingManager, maybe in Volo.Abp.Identity.Application - sorry I cannot find it

    Thanks, Navneet

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Volo.Abp.Identity.IdentitySettingsAppService(Volo.Abp.Identity.Pro.Application)

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Navneet@aol.com.au created

    Thanks Maliming, this is exactly what I was looking for.

    You are the best :-)

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.