I am working on some automation for our Confluence pages. I contacted my IT team who created a token using a service account. IT has confirmed that they can access the space on Confluence (where we want the automation to exist) when logged in under that service account.
However, when I try to setup automation using that token and python's requests library in the following code:
resp = requests.get(
url=f"[redacted link]",
verify=False,
headers={
'Authorization': f'Basic [redacted Atlassian key]',
}
)
print(resp.content)
I get this error response:
b'{"errors":[{"status":404,"code":"NOT_FOUND","title":"Not Found","detail":null}]}
Any ideas on why we can access this page when logged in but we get authorization issues when using the token?
Ensure you pass the service account as the user when using its token.
The docs for using the token via API calls are here:
https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/
Also, look at sunnyape's answer to this thread.
That was our problem, we were not passing the service account with the token. Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.