It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error 401 when attempting to log in to confluence using rest api Edited

I've tried just about everything. But I'm unable to log into the confluence server via the rest api with my credentials. I'm using a user name:api token and encoded it to base 64 per the instructions you see here:


but i keep getting error 401


Basic Authentication Failure - Reason : com.atlassian.crowd.exception.FailedAuthenticationException: com.atlassian.crowd.exception.InvalidAuthenticationException: Invalid credentials</p><p>Description The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class="line" /><h3>Apache Tomcat/7.0.91</h3></body></html>


What's worse is that when I go to the token management page the token says "never accessed". 


I know atlassian can find my account (because if I put a typo in my email address i get an error saying the account couldn't be found). My base url is https://<domain> where <domain> is the name of my company.


I'm simply trying to execute  https://<domain> When I manually log in and type in https://<domain> I successfully get the Json string i'm expecting.



Oh and I'm using the cloud version.

3 answers

2 accepted

0 votes
Answer accepted

Looks like you are using a username for credentials. Can you try with your email as user ? 

I’m actually using my email address. As i mentioned, atlassian is able to find my account because if i introduce a typo into my email address atlassian returns an error saying the account couldn’t be found. 

0 votes
Answer accepted
Warren Community Leader Jul 31, 2019

Hi @Chris Cilino 

Have you tried to do the same thing via Postman (online or via app)? This isolates whether the problem is with your code or the authentication process, so can be useful.

Another option is to show more of your code here, because I've often seen people using the incorrect settings or missing a setting.

postman helped out a ton. turns out my base64 encoder was busted. Thanks War!

Care to explain how this affected you. I am having the same issue, but I don't have any base64 encoding/decoding issue. I have the exact problem you have though, if I change the e-mail it recognizes that the account doesn't exist. If I run with my credentials that I can log into the website with, it just flat out 401s me. I run the API url in the web-browser when logged in and I get a nice API response.

In Postman I am running as an example a GET-call against <site>

I have Type: Basic Auth, and create an Authorization header with my correct username and password. I leave the Body empty for the GET-request (I say this, because I actually want to POST and create a page, but easier to solve this issue with less complex variables).

Anyone know anything how to fix this or where the problem could be?

Warren Community Leader Sep 09, 2019

Hi @harpan 

You can't use your password for API calls via Postman or code, it needs to be an API token - see this article

Like # people like this

Thank you, I actually found that answer on another page finally and tried it and it worked better! Thank you for the quick response!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

283 views 9 7
Join discussion

Community Events

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

Events near you