Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

TlsVersionException - You are attempting to connect to Xero using TLS 1.0

Started by Mike warlow -   in API Authentication

Hello All

In June this year I change my c# software to work with TLS 1.2 by adding the line

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Before my API calls


System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
X509Certificate2 cert = new X509Certificate2(@"C:\OpenSSL-Win32\bin\public_privatekey.pfx", "xxxxxxxxx");
var private_app_api = new XeroCoreApi("https://api.xero.com", new PrivateAuthenticator(cert),
new Consumer("xxxxx", "xxxxx"), null,
new DefaultMapper(), new DefaultMapper());
var user = new ApiUser { Name = Environment.MachineName };
var Accounts = private_app_api.Accounts.Find();

However since last week on 3 separate occasions the software has stopped on the line which says var Accounts = private_app_api.Accounts.Find(); and given me the error message below on the Web page. If I wait a few minutes and try again all works fine.

I can only assume this is something on Xero side? As I have 1.2 in use as per the first line above and also 99% of the time it all works fine, with just this occasional glitch that we have seen?

"ErrorNumber": 412,
"Type": "TlsVersionException",
"Message": "You are attempting to connect to Xero using TLS 1.0 which has been deprecated. Please use a newer TLS version. Please Contact the API support team at api@xero.com for more assistance."

Any ideas much appreciated