https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#auth/1/session-login uses basic authentication and cookies, in curl, to create an avatar issuetype. However, I am not seeing an example using JIRA REST API oauth client.
I have tried the equivalent of the curl command below using Java and successfully got the JSESSIONID from the response header.
curl -c cookiejar.txt -X POST -u admin:admin -H "X-Atlassian-Token: no-check" \ -H "Content-Type: image/png" --data-binary @mynewavatar.png \ 'http://localhost:8090/jira/rest/api/2/issuetype/1/avatar/temporary?filename=mynewavatar.png'
However, when I add a cookie with the same JSESSIONID to the second request, it returned a 500 response code with the following message:
com.google.api.client.http.HttpResponseException: 500
{"errorMessages":["Uploading the avatar has failed. Please check that you are logged in and have sufficient permissions."],"errors":{}}
I also tried getting the JSESSIONID using basic authentication and passed the JSESSIONID to the second request....that worked.
Could someone please explain to me why basic authentication JSESSIONIDs work but JIRA Server REST API oauth client JSESSIONIDs do not?
Thank you in advance.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.