Skip to content

How To Incude Tenant_ID in ProjectsAPI / FileAPI. Authentication Unsuccessful #116

Description

@dempstert

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()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions