The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Shawn Doyle - ReleaseTEAM
Community Champion
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!

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events