How To Incude Tenant_ID in ProjectsAPI / FileAPI. Authentication Unsuccessful
I am trying to connect to the projects API using this library.
I am running into this issue:
{"Type":null,"Title":"Forbidden","Status":403,"Detail":"AuthenticationUnsuccessful","Instance":"<my_instance_id>","Extensions":{}}
I am explicitly providing my tenant id, but the API calls still fail. This is only an issue for projects and files.
The same code below will work for invoices, users etc etc.
What I've Tried
from xero import Xero
from xero.auth import OAuth2Credentials
creds = {
'client_id': ...,
'client_secret': ...,
'callback_uri': ...,
'auth_state': ...,
'token': {
....
},
'scope': ['projects', ....]
}
oauth_creds = OAuth2Credentials(**creds)
tenant_id = oauth_creds.tenant_id
oauth_creds.set_default_tenant()
xero = Xero(oauth_creds)
xero.projectsAPI.projects.all()
Result
{"Type":null,"Title":"Forbidden","Status":403,"Detail":"AuthenticationUnsuccessful","Instance":"<my_instance_id>","Extensions":{}}
Note The following WILL work
xero.users.all()
PETOSS-316
Thanks for raising an issue, a ticket has been created to track your request
Hi @dempstert , can you provide the name of your Xero app or tenant? Any Xero-Correlation-Id from a response header would work as well.