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

REST APIv3 always returns 401 Unauthorized with OAuth2.0 Token Edited

I have been researching on how to access the /search?jql endpoint that now went 401 Unauthorized. It used to always return the data without any trouble.

Example request

curl -X GET '' -H 'Authorization: Bearer abc123'

I have asked for the user's consent for all of the scopes available there is, but it still gives me a 401 Unauthorized, with a response body

{"message":"Client must be authenticated to access this resource.","status-code":401}


1 answer

0 votes
Warren Community Leader Oct 25, 2019

Hi @Adam Fadhil S 

This generally happens because of a change made a few months ago, regarding the change from using a password to an API token. See this for further details

Hi @Warren the linked topic is about deprecation of using basic authentication with passwords and suggested us to use OAuth or API Token. I am currently using OAuth token, but still getting 401 Unauthorised. Do you have any other suggestions?

Warren Community Leader Oct 28, 2019

Hi @Adam Fadhil S 

Okay, then I would suggest using Postman (either online or download the app) - I've found it really useful. If it works in Postman, then there's something wrong with your curl statement

Hi @Warren ,

I am currently using Postman, the curL request is only for posting in here. And I still get the same error unfortunately.

What other factors should I bee looking into? I always clear my cookies when doing a request with Postman also.

Warren Community Leader Oct 28, 2019

Hi @Adam Fadhil S 

So re-reading your initial question, this used to work? The exact same API call / JQL / authorisation details used to work but now doesn't? If so, you may want to regenerate your API token and try again.

Possibly try with a much simplified call, something like ?jql=key=ABC-123 so that it is just trying to return one issue that you know you have access to.

Give us a screenshot of the Postman screen, with sensitive info (your API key) redacted.

Screen Shot 2019-10-28 at 15.47.10.pngScreen Shot 2019-10-28 at 15.37.52.png

Hi @Warren , the above are the Postman API Request using Postman and the consent asked to the user

Warren Community Leader Oct 28, 2019

Hi @Adam Fadhil S 

You're using Bearer for authentication, it should be Basic

Hi @Warren 

Are you sure? I am using OAuth2.0 authentication method. The response itself tells that the token_type is Bearer.

I've tried using Basic but it gives me a different 401 error.


Screen Shot 2019-10-28 at 16.45.25.png

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Introducing new features for Jira Software Cloud's roadmap

Hi Atlassian community, A few months ago, we offered a sneak peak of the new hierarchy view on the roadmap. Thank you for all the feedback (and excitement) and for helping us shape the direction of...

25,044 views 116 87
Read article

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