0

I am trying to get a list of my accounts using GET:https://api.xero.com/api.xro/2.0/Accounts with my access token.

The response is 401 / Unauthorized

My app has these scopes:

accounting.transactions
accounting.transactions.read
accounting.settings
accounting.settings.read
accounting.contacts
accounting.contacts.read

accounting.settings.read should be adequate according to the Scopes documentation

I am using the same PHP code used to GET:/Invoices which works fine, with headers:

Accept: application/json
authorization: Bearer $access_token

I am using a Custom Connection, as we have a machine-to-machine setup with no interface.

The App configuration screen, and available scopes are shown here:

screenshot of Xero Custom Connection app configuration screen

Full list of available scopes within my Xero Custom Connection app

Ade
  • 2,961
  • 4
  • 30
  • 47
  • Do you also have `offline_access` and `openid` in your scope? I have what you have, those two, and `email` in mine, for a similar scenario, but not using a Custom Connection. Is that the new monthly-paid connection type? – droopsnoot Nov 15 '21 at 17:55
  • @droopsnoot none of `offline_access`, `openid` or `email` are options in the scopes list. And yes it's the monthly-paid custom connection type – Ade Nov 16 '21 at 09:16
  • 1
    Ah, sorry, can't help then, that's a different connection type to the one I'm using. The doc suggests that `accounting.settings` is the one you need, and you have it. My only other suggestion is contact the API support team and see if they can look at your API call from their end and see what the problem is. – droopsnoot Nov 16 '21 at 09:50
  • @droopsnoot FWIW I raised it with Xero support and having gone through several attempts for them they have now said they will raise it with the Xero developers. So I think it is in fact a bug. – Ade Nov 18 '21 at 11:40
  • Thanks for the update. – droopsnoot Nov 18 '21 at 18:18

0 Answers0