Xero oauth2: dropping connection

I am having issues with keeping the Oauth2 connection with Xero which I didn’t a few versions back.

Is this a general issue or just my instance?

I get the below but if I run the https://api.xero.com/connections with the same credentials (not reconnected) I do get the instances I am connected to.

It works re-running the flow after I reconnected the credentials though.

{
   "body":{
      "Type":null,
      "Title":"Unauthorized",
      "Status":401,
      "Detail":"TokenExpired: token expired at 12/07/2022 12:26:15",
      "Instance":"xxxxx",
      "Extensions":{
      }
   }
}

@Jon I know that you have good experience on Xero.

I am using the same credentials for getTenant as I am for createContact. GetTenant get a full response whereas createContact get an expired token message.

It’s really weird and I have no idea why this is happening. Always works if I reconnect, then re-run the failed execution (but only for 30 minutes off course).

I am using the pre-defined Xero oauth which has the scope offline.

Hey @ericsonmartin,

What version of n8n are you running? It sounds like something we fixed in 206 with oauth credentials not refreshing correctly.

I’m on 206 since Friday but actually in the afternoon today, it seems like it has worked to keep the connection.

Hey @ericsonmartin,

So is it all good now or are you still having problems with it?

Definitely seems fixed. Not sure why it wasn’t immediate as I upgraded though. But less important to figure out.