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."
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.