Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Custom Connection consent screen not allowing company selection

Started by Rob Roy -   in API Authentication

TL;DR; The Xero | User Consent "Select and organisation" drop-down lists Demo Company (AU) and my two companies, but only the first Demo Company option is selectable. The other two companies are listed but ghosted and unselectable, even though one shows "Subscription already activated".

LONGER VERSION

My Xero profile is connected to two companies (let's call them MyOldCompany and MyNewCompany), as well as the Demo Company (AU) and the Developer site.

Old Company has an OAuth 2.0 app (converted from OAuth 1.0), but we are migrating the business to a new structure and Xero company (hence MyNewCompany)

I have purchased Custom Connection for MyNewCompany, and it shows as active.

In the developer site I created two new "Custom connection" apps - the intention was to have one set of credentials for the Demo Company and a second for MyNewCompany. I noted down the Client Id and Secret for each.

It gets a little foggy here as I had lots of issues switching between companies (Xero and Safari don't play nice with authentication and I have to keep restarting Safari. And/or Xero doesn't seem to allow different companies in different tabs.) I completed my PHP code development using the Demo Company and then switched my environment to the Client Id and Secret for MyNewCompany. At that point I discovered both Custom connection apps were pointing at the Demo Company. NOTE: I'm not sure this is a bug - I may have inadvertently authorised the wrong company, although I don't think I did.

I tried changing the misdirected app back to MyNewCompany but the User Consent screen only allowed selection of the Demo Company.

I finally deleted the app and created a whole new App with grants for accounting transactions, contacts and settings.read. I logged out and back in with the link in the resulting "Approve your Xero custom integration" email, but no matter what I try the "Select an organisation" only allows selection of the first, "Demo Company AU" option. My two companies are listed, but in grey.

Is there a limit of a single Custom Connection app for a company? Is it possible that limit is not being reset when the app is removed? Or something else?
Further to my post, this page says "You can only have one custom connection per Xero organisation." So that answers that question.

However, the "Organisation settings" page for MyNewCompany clearly says "No connected apps." (not even the API Explorer - I removed that just in case) and the "My Apps" page in the Xero Developer site still shows "Pending connection" for the Custom connection app I created.

My theory is that the limit of one connected app is not being reset when the single permitted app is removed.

Come on Xero - please get back to me.
 

Rob Roy  

I was just advised by Xero Support that the issue was resolved and to try again. I was then able to successfully attach my Custom Connection app to MyNewCompany.

Thanks Xero Support!
 

Rob Roy  

Hi,

I am also getting this issue. Where I assigned some permissions to my org and connected it successfully and then realised that to create an invoice you need an item and to get an item you need to grant settings.read as well.
So added that option and now cannot assign anything to the organisation with the same error "Subscription already active"

Tried removing and recreating the application and still get the issue where you can't connect the application to the org.

Seems the fix they did was just to your account and not to the system code.
 

Stephen Edwards  

There are lots of issues with the application management pages, particularly the "Authorisation details" page which only seems to exist for Custom Connection apps. I more often than not had issues getting that page to even load. There are clearly major bugs in the code with anything to do with modification of grants or removal and replacement of the app to a company.
 

Rob Roy  

I was having similar issues, but I believe I understand what's going on now (no thanks to Xero support).

I had one app connected to the Demo Company (for dev and test purposes), and another app connected to my real organisation.

Everything was fine until the app connected to the Demo Company suddenly lost connection. Xero Support didn't offer a definitive answer as to why, but we both think the connection is lost when the Demo Company resets. I'll find out next month I guess.

When I went to reconnect my test app to the Demo Company, I got the "Subscription already active" error, and no option to select the Demo Company on the authorisation page.

I eventually figured out that I had to switch organisations in Xero prior to doing the authorisation.

If I go to Xero, switch to the Demo Company, and then authorise my application, the authorisation screen will allow me to select the Demo Company.

The reverse is also true. If I am currently viewing my other organisation in Xero, the authorisation screen will only show me that organisation (and complain that my subscription to that organisation is already active).

TL;DR -- go to Xero and switch to the organisation you want to authorise prior to authorising your app.
 

Andy Abel