[SOLVED] Twilio “Invalid TLS protocol” error using C# helper library

Question

This Content is from Stack Overflow. Question asked by shrekDeep

I am unable to invoke Twilio api functions. I know Twilio has upgraded their security and I have got the email for same in past and I have gone through the upgrade.
https://support.twilio.com/hc/en-us/articles/360006751753-Tips-for-Upgrading-Your-Environment-to-Support-Twilio-REST-API-s-TLS-and-Strong-Cipher-Suite-Changes

My production environment is updated and I am able to get an xml result when hitting the url: https://api.twilio.com:8443 from my production environment browser. https://support.twilio.com/hc/en-us/articles/226478767-Monitoring-Updates-to-Twilio-REST-API-Security-Settings says “If your HTTP request succeeds, no changes will be needed on your end for the update.”

However in the process, I also updated the Twilio C# api (.Net Framework 4.6.1) (https://www.nuget.org/packages/Twilio). Even after all the steps and tests I am still getting “Invalid TLS protocol” error using following code:

public string sentToday()
        {
            string sTotalTodaysRecord = "0";
            string AccountId = ConfigurationManager.AppSettings["AccountId"];
            string AuthToken = ConfigurationManager.AppSettings["AuthToken"];
            TwilioClient.Init(AccountId, AuthToken);
            var records = TodayResource.Read();
            foreach (var record in records)
            {
                sTotalTodaysRecord = record.Count;
                break;
            }
            return sTotalTodaysRecord;
        }

TwilioClient.Init(AccountId, AuthToken); // this part throws the exception "Invalid TLS Protocol"

Twilio updated their security during 2019-2020 and we updated our production server back then. Also we were able to send SMSes using Twilio till last week so why it suddenly stopped working.

Solution

use this to resolve problem

Open node_modules and then search for react-native-material-textfield open the file and go to src folder
Under src you will see affix, helper, label folder – under each folder, there is an index.js
open the index.js of the mentioned folders one by one (all 3 folders) and search for the text style: Animated.Text.propTypes.style, and replace it by style: Text.propTypes
And import text form react-native like this import { Animated , Text} from ‘react-native’;
And now reload the terminal, and you are good to go

Answered by nitishkumar325 (nitish kumar) · GitHub


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 4.0.

people found this article helpful. What about you?