atlassian-python-api
atlassian-python-api copied to clipboard
401 with scoped access token
I have created a scoped PAT with scopes:
read:page:confluence
write:page:confluence
Due to #1199, the client is then initiated as follows:
confluence = Confluence(
url=CONFLUENCE_BASE_URL,
username=CONFLUENCE_USER,
password=CONFLUENCE_API_TOKEN,
cloud=True
)
Now when doing a call like
page = confluence.get_page_by_id(CONFLUENCE_PAGE_ID)
It results in a requests.exceptions.HTTPError: Unauthorized (401)
It works when using an unscoped access token. This is version 4.0.4.
curious if you were able to find a workaround for this, apart from using an unscoped access token?
No, I have't tested further. I'm waiting on some clarifying comments from Atlassian. Also on the other library issues.
All good, I think atlassian-python-api is an unofficial repo unrelated to atlassian, and i don't have any domain knowledge on confluence REST APIs 😅 hopefully @gonchik has capacity to look into it
According to the information provided on this page, the endpoint changes when using a scoped token.
I was able to access it with the following setting:
CONFLUENCE_BASE_URL=https://api.atlassian.com/ex/confluence/{cloudid}
We are able to find the cloudid at https://{your-domain}.atlassian.net/_edge/tenant_info.
@dddlr you're right, this project is unofficial, but only mentions it in the fine print. From the appearance it seemed official :(
@hajimegane Thank you for the hint. This got it working, but the API Documentation is incomplete, so it's a guesswork to find the right scopes. Created several tickets with Atlassian, so they improve their documentation.
@lobeck did you get it working with the scope? Can you please provide a small working example? Thanks
@ksaurabhAparavi no. I also asked Atlassian support about it and they noted, that scopes only work with the v2 API which is not implemented in this library yet.