We are trying to invoke the Confluence REST API on-premise end point and it looks like it is not sufficient to provide only user id and password to get the content. When we provide a JSESSIONID cookie in the REST API end point as HTTP header then only we get the data.
The question is what could be the reason that we are not able to use userid and password combination as mentioned in the documentation (https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/ ) in consuming REST API from confluence on-premise solution.
For example -
The below command is not giving any data
curl -u <userid>:<password> -X GET "https://wiki.xxx.dk/rest/api/space?spaceKey=~userid"
The below command provides us data.
curl -u m42713:xxxxxx --header 'Cookie: JSESSIONID=9DZZZZZZZZZZZZZZCCCCCCCCC1' \
-X GET "https://wiki.xxx.dk/rest/api/space?spaceKey=~userid"
Hello @Thomas Ladefoged !
As I understand, you are currently trying to authenticate using basic authentication in Confluence On-Premises (Server/Data Center) but is unable to.
I am not entirely sure what is the meaning of “The below command is not giving any data”. Does it mean that:
- Are errors thrown when you try to authenticate?
- Has this worked at some point?
- Do you have some kind of SSO implemented on your instance?
- Are you using userID or username to try and login to the instance?
- Are there entries on your Confluence log file for when you try to login?
Also, here we have some documentation that can help you on this setup:
Let us hear from you!
I had a similar problem with authentication REST APIs towards Confluence after Atlassian deprecated the user+pwd authentication June 2023. When I had to switch to using a Personal Access Token, I read everywhere I should be using "Authorization: Basic " + Encoded user name + ": " + PAT, but that's only for Cloud deployments, for on-premise installations I had to use "Authorization: Basic " + Encoded PAT-token.
Details are explained here: https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html.
So properly documented in the end, just I went by everyone else's solutions posted on in Atlassian chats. All in all - the documentation is correct, but perhaps a bit vague.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.