Getting response error (400) when contacting REST API through JIRA API TOKEN

Trying to make a GET request to the REST API using Jira API token. Works on the browser through google extensions using the SAME token. I literally copied the request to make sure I was not messing something up. Yet, it doesn’t work still.

My request:

Method: GET,

URL: https://jiracloud.COMPANY.com.br//rest/api/2/search?fields=fields,key&jql=worklogAuthor=currentUser(),
Headers: {

   "content-type": "application/json",

   "cache-control": "no-cache",

    "app_token": "myToken"
}

Through the browser and/or Google Extensions that makes this same request I receive:

Status: 200

Through Postman or any code OUTSIDE the browser:

Status: 400,

Error: "Field 'worklogAuthor' does not exist or this field cannot be viewed by anonymous users."

I tried everything I could think of, don’t know what else to do. Tried even using the the same “User-Agent” and Cookies as the browser uses to make the request…What am I missing? It must be something really obvious.

Thanks

In the browser you are using the session authentication with cookies.

Where have You found the notation with the app_token?
Please check this guide how to build a proper authorization header with the API token.

https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/

Right here: jiraworklogtool/jira-helper.js at master · alfeugds/jiraworklogtool · GitHub

It’s being really frustrating figuring out the docs, since they lead nowhere. I’ll consider that this is somehow using the Cookies to manage auth. I’ll try following the link you provided and will get back to you.

Thanks

Right so, trying to curl the following after generating a token:

curl -v https://jiracloud.company.com.br --user username:token

Returns me the same 401.