0

Getting 403 Authentication failure while disconnecting from a xero organisation after the access token is expired (I.e. 30 minutes after the token creation). I am using C# (.NET 4.6.1) and have tried refreshing the access token using client.RefreshAccessTokenAsync method. The method generates new access token and refresh token but authentication failure is generated at the time of disconnecting the organization.

Any idea where I am wrong?

User_18
  • 1
  • 2
  • The original connection may not be closing and preventing from creating another connection. From cmd.exe >Netstat -a which will give status of the connection. Try at both client and server. – jdweng Dec 03 '20 at 16:35

1 Answers1

0

Either deleting or revoking will require a valid access_token so your statement that you are trying to do this after the access token is expired (I.e. 30 minutes after the token creation)..

It is expected you would get a 401 (for any API call) with an expired token

Are you sure you have swapped in the refreshed access_token prior to making the disconnection call?

Removing connections If you would like to remove an individual tenant connection from your app (e.g. a user wants to disconnect one of their orgs) you can make a DELETE request on the Connections endpoint:

Header -> Authorization: "Bearer " + access_token
DELETE https://api.xero.com/connections/{connectionId}
SerKnight
  • 2,502
  • 1
  • 16
  • 18