Issue authentication with JIRA REST API

taiebaf October 18, 2019

I followed this tutorial https://developer.atlassian.com/cloud/jira/service-desk/jira-rest-api-oauth-authentication/ to generate an access_token, it's working pretty well, i can perform my call with


java -jar OAuthTutorialClient-1.0.jar request https://jiratest.jira.net/rest/api/2/user?username=me\

but when i try with curl or postman

curl --request GET \
--url https://jiratest.jira.net/rest/api/2/user?username=me\
--header 'Authorization: Bearer MYACCESSTOKEN' \
--header 'Accept: application/json'

I always get "You are not authenticated. Authentication required to perform this operation."

1 answer

0 votes
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 21, 2019

Hello,

Thanks for including the rest call, and looking at the request it is failing because of the auth method in use being Bearer authentication in your script instead of Basic authentication with API Token similar to the exe curl command found HERE.

I believe all you need to do to correct this is to use basic authentication using the API Token to authenticate your calls, in your code try setting the header is set to:

"Authorization""Basic user:api_token"

 Let me know if this does the trick.

Regards,
Earl

Suggest an answer

Log in or Sign up to answer