Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

OAuth2 application migration

Started by Tony Carter2 -   in API Authentication


We had a private application which would take the ConsumerKey and ConsumerSecret from a database, connect to Xero, get Profit&Loss and similar reports and load the data into a database for internal reporting. It was all done automatically, with no need to click "Allow access" or "Connect to Xero".

This app was using OAuth 1 and was built on top of Xero sample app. It was using a private Xero app. Now with OAuth 2 there are no private apps any more.

What is the easiest way switch the application to using OAuth 2? Should I try to replace OAuth 1 code in my app with OAuth 2 code? Or should I take another sample app and move my code to it? (it is in C#).
Do I need to purchase a custom connection or one of the two other application options will work ("Web App" or "Mobile or Desktop App")?

I need the application to run automatically, without any user input.

Hi Tony,

You can continue to use a console app but you'll need to authenticate once using https://developer.xero.com/documentation/guides/oauth2/pkce-flow/ then store the keys in a local db like sqlite and you should be good to go. The idea is then that you refresh the token every time you connect and thus only a single sign on is needed

Kind Regards

Remember I consult on a per hour basis. Contact me if your need me to fix the problem. $65 per hour.

We can do a 30 min free consultation via Skype.

Henzard Kruger
Certified Advisor and Full Stack developer
Picahoo cc - 0711304241 - henzard@picahoo.co.za
Skype: henzard, Gtalk: henzardkruger@gmail.com
Quality is remembered long after the price is forgotten

I abide by the 3 message rule. After 3 messages we skype.

Henzard Kruger