Connecting to Xero API

Mike Matthews - Omnis omnis at
Wed Jun 2 08:44:05 UTC 2021

I think you always end up opening a browser window to get the first auth token.

Last year, HMRC and the VAT used oBrowser, but with oAuth2, a new browser window is needed to get that token back.

Once you have it, the oAuth2 external will keep it alive and refreshed, every set period of time.

Is this any different from Microsoft O365 authentication, with 2FA?  No, as that happens in a browser, but MacMail picks it up and continues somehow.

I will try the Google one later, as that is interesting.

Mike Matthews

Lineal Software Solutions
Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>

omnis at<mailto:mike.matthews at><><>

On 2 Jun 2021, at 08:58, Phil (OmnisList) via omnisdev-en <omnisdev-en at<mailto:omnisdev-en at>> wrote:

Hi Reg,

in the simplest of terms, for Xero you need to run this external executable...

For google calendar, another thing I originally did in Python, you don't, it will open up a browser window for you to authenticate the login.

I did manage to, reasonably easily, recreate the calendar code in Omnis.

I understand the black box element of the Omnis OAuth solution, but I think it works well in my calendar example.

I never followed through with trying to get Xero to work in Omnis.

Phil Potter
Based in Chester in the UK.

On 02/06/2021 00:13, Reg Paling wrote:
Hi Phil,

Thank you - I will try Xero's xoauth piece as you recommend.

When you say "People say Xero didn't do it correctly...", can you elaborate or give me a link where I can understand why?  I am asking because I will soon have to connect to Medicare Australia using OAuth 2.0 and I suspect that this also may not easily fit the pattern which Omnis OAuth 2.0 expects.  The Omnis OAuth 2.0 component looks like a black box and I haven't found out how to know what's going on inside the black box if things need to be "non-standard".  So I am wondering whether to start by trying to use Omnis OAuth 2.0, or whether to start by trying to roll my own.  Or perhaps integrate a node.js component if there is one...

A supplementary question: has anyone managed to connect to PRODA - i.e. [Australia's Medical] Provider Digital Access system?

And another supplementary question: what sort of things have Omnis OAuth 2.0 been successfully used for and is there any sample code available?  Yes, I know about the sample code in the Hub but which services does it work for, and which services does it not work for?  For instance Mike, is it possible to make a connection to HMRC using the sample window, or is extra code required to jump through the hoops you mentioned in another post?


On 2/6/21 12:49 am, Phil (OmnisList) via omnisdev-en wrote:
Hi Reg,

Yes, but... I ended up using Python to do an integration...

People say Xero didn't do it correctly...

But whatever, to set up the connection, on windows at least, you need to use their executable, xoauth.exe, which sets up the first connection...
(There is a Mac version also)
after you have setup a connection on the accounts you are using...
use this to tell you the required tokens you need.

This is instead of a popup browser window to get the first set of tokens.

once you have tokens, step one when I run the script, is to refresh the tokens.

which provides a valid access token, from which, generally most things just work as normal.

Refresh tokens last a long time, so in all likelihood, you will never need to run the xoauth.exe ever again.

I had done an integration when Xero were using OAUTH1, and then they changed it, and the only resolution was to use there xoauth.exe to do the initial login.

In retrospect, I believe it would be achievable within Omnis to do this, after the initial xoauth,exe setup...

But my solution was not one for all users, so it was kept separate, so only users needing this functionality, needed this script...

Phil Potter
Based in Chester in the UK.

On 01/06/2021 15:26, Reg Paling wrote:
Hi all,

Has anyone succeeded in connecting to the Xero API?

I am trying to use the OAuth2 worker object and not getting far as yet... trying to work out terminology...


Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at
Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at

More information about the omnisdev-en mailing list