You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I want to authenticate to our confluence server via curl.
I use
curl https://<MY HOST>/rest/pat/latest/tokens -H "Authorization: Bearer <MY PAT>"-H "Content-Type: application/json"
which results in
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>401</status-code><message>Client must be authenticated to access this resource.</message></status>
I also tried
curl https://<MY HOST>/rest/pat/latest/tokens -H "Authorization: Basic username:password"-H "Content-Type: application/json"
All results in the above response. When I call the /rest/pat/latest/tokens via browser after successful login I receive the correct tokens.
Are there any additional configuration settings in confluence to make the curl requests work?
Thanks in advance!
Hello @twentyonetwice .
Can you try to set the url as the last parameter?
curl -H "Authorization: Basic ${BASE64_TOKEN}" -H "Content-Type: application/json" https://<MY HOST>/rest/pat/latest/tokens
BASE64_TOKEN is a "user:password" string encoded to base64 format.
e.g. with user admin and admin
echo admin:admin | base64 -> dXNlcjp1c2VyCg==
curl -H "Authorization: Basic dXNlcjp1c2VyCg==" -H "Content-Type: application/json" https://<MY HOST>/rest/pat/latest/tokens
Hi Andrii,
I already tried it the way you described. Url at last, basic authorization with base64-encoded username/password string. All tries resulted in the same response.
The docs are explaining both ways, but none of them is working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to clarify: if you use already created PAT then you should use the Bearer type:
"Authorization: Bearer $Atlas_Token"
Basic auth is used with user and password.
Also, you can try other common REST API endpoint like
https://<MY HOST>/rest/api/content/
to check access to content.
https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried it both ways, the Bearer Authentication and the Basic Authentication.
I've also tried it with rest/api/content, /rest/api/space and /rest/api/space/<SPACE_KEY>
None of those tries worked for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suppose this is some inconsistency of using the correct user with the correct permissions and corresponding token, as it works well in such cases with correct config. Could you please make sure the user has correct Global permissions and instance level permissions?
Just to make sure the access is OK, you can try to use other tool like Postman, HttPie, etc. to see if it works well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Andrii Maliuta Finally we solve this problem. All my requests were correct, but there was a http-proxy before our confluence installation.
Thanks for your efforts!
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.