My API Token Cannot Access A Page That The User of The Token Can, What Settings to Change?

Chris Mallinson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 2, 2024

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?

1 answer

1 accepted

1 vote
Answer accepted
Shawn Doyle - ReleaseTEAM
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2024

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. 

https://community.developer.atlassian.com/t/api-token-authentication-contradictory-documentation/66594

Chris Mallinson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 9, 2024

That was our problem, we were not passing the service account with the token. Thanks for the help!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events