Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Can't select demo company

Started by Jim O'Halloran -   in API Authentication

I've been developing a CRM integration to Xero and have everything working fine on my local machine connected to my demo company. When I go through the OAuth 2 flow I can choose between two companies, my client's live company file (to which I don't have sufficient permissions), and my Demo Company file.

Today we were attempting to set up the integration on the staging site to one of the customer's own users so it can access their demo company (since you can't share access to a demo company). I tried with the OAuth application being set up in my account on developer.xero.com and also in the customer's login. Both times, when the user is asked to connect the application on the Xero side, they don't get the option to see the demo company, it seems like we can only connect to the live file.

Is the option to connect to the demo company only available if you don't have sufficient access to any live companies? Alternately, is there something we need to do in the demo to make it visible to the API so we can connect to it?

It's been 2 weeks now. Can someone from Xero offer any assistance with this? Willing to pay for support.

Jim O'Halloran  

Hi, did you ever get an answer to this?


Reg Jackson  

No, I didn't (thanks Xero!). But after fiddling with the client's account a little more I came to the following conclusion.

While Xero says they "reset" the Demo Company every 28 days, what I'm guessing they actually do is delete it, and leave it deleted until you access it again. It's visible through the UI at all times, so it looks like you always have a demo company available, but Xero isn't hosting thousands of inactive demos that no one is using. The OAuth setup seems to be the one area where the abstraction leaks, if you don't have an active demo company it disappears from the Oauth screens.

What I did, which seemed to work for me, is to log into the Xero UI using the user account I later wanted to OAuth with. Then access that user's demo company. Finally, I went back to my app and ran through the OAuth routine and the demo company was there. If my theory is correct, the initial login and access of the demo company is creating that user's demo, then it's available through OAuth.

Hopefully that works for you too. It's a pity Xero haven't documented this because I spent hours trying to figure it out.


Jim O'Halloran  

I see, that's great Jim, thanks for the help.


Reg Jackson  

A shame that Xero never replied to you.

I can confirm that your trick works though. Simply browsing to the Demo Company is enough to make it show up in the list of organisations. Thanks for documenting that here!

Adam Reis  

Thanks, glad to get confirmation that it worked for you too! I might need this trick again myself in the coming days!


Jim O'Halloran  

I'm having the same issue now, but the demo organization cannot be selected on Xero's website after logging in.

Webmaster VirtualCoworker  

I was unable to select the demo company on the oath screen too, the above comment helped me with one instance of the app (simply opening the demo company in the Xero API) worked. For the other app it did not appear until after I had cleared the browser cache as well. Now it has allowed me to authorize on both. finally Thanks Jim!

Tim Thomas  

I'm glad this post is still helping others. It's a pity that there's been nothing "official" from Xero even after almost 2 years.

Jim O'Halloran