Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dempstert opened this issue Jul 20, 2023 · 3 comments

Comments

@dempstert
Copy link

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()
@github-actions
Copy link

PETOSS-316

@github-actions
Copy link

Thanks for raising an issue, a ticket has been created to track your request

@rdemarco-xero
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants