When trying to run the following curl command:
curl -u firstname.lastname@example.org:password -X GET "https://wiki.myorg.edu/rest/api/content"
I get the following error message:
HTTP Status 401 – Unauthorized: Basic Authentication Failure - Reason : AUTHENTICATED_FAILED. The request has not been applied because it lacks valid authentication credentials for the target resource
We are using SSO to log in to confluence and and are syncing with AD. This error seems to occur for just one account, but not other accounts (I've only been able to reproduce the error for just the one account). I am able to log into confluence so I can confirm that the credentials are correct.
Unfortunately, I am not an admin and don't have much insight into logs or admin settings.
Generally, when it's only one user having issues it's a permissions problem, whether through the REST API or the UI. I know it's an error 401, not 404, but it wouldn't hurt to check.
You mentioned that the user is able to login to Confluence, which I'm assuming means s/he has a license, but can the user access the specific content, not just Confluence, through a browser?
Does the user have permissions to the space in which the content you're trying to pull is located? Are there any page restrictions that may be limiting that user from accessing the content.
And to ask a stupid question, are the username and password both spelled correctly?
Otherwise, these are the things I see as different from how I do it:
Are you passing a base64 encoded username/password?
Do you use the request header?
Yes, permissions issue was my thought as well. I am able to view and edit pages within some spaces that the admin gave it access to within the browser. I believe our admin gave full access to the space, I'll have to wait a few days for him to get back from vacation before I can confirm this (I don't have admin access to change the permissions).
Yes, I did confirm that the username and password are correct. Just to be sure, I copied the password and logged into the browser first and copied it over to the curl command so that I made sure it was the same. We also have some tools that can tell if an account gets locked if there are too many incorrect login attempts, and I can confirm that the account never gets locked with multiple attempts.
I am not passing a base64 encoded username/password. Other accounts that I have used did not require a base64 encoded username/password and they were able to access the api with no issues.
I added X-Atlassian-Token:no-check, but it looks like it did not work.
I still get the same error using Postman. Yes I can see content when I access that endpoint on a browser. The admin was able to give that account full access to some spaces and pages in those spaces, giving the account the ability to read and make edits to pages via the browser.
Welcome to Confluence’s Holiday Workshop, where knowledge and collaboration collide! This year come celebrate the holidays with brand-new Confluence features to kickoff your new year, best practice...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events