When I make a GET request via Postman to
https://<my-company>.atlassian.net/rest/api/2/search
I get back a list of issues as expected. When try to make the same request in chrome using javascript, I get back an empty response with a 200 status.
Here's my JS:
const token = btoa("<username>:<app token>"); // base64encode basic auth token
const URL = `https://<my-company>.atlassian.net/rest/api/2/search`;
const response = await fetch(URL, {
headers: {
Authorization: `Basic ${token}`
}
});
I am running this from localhost:8080 in case that matters.
If I use an incorrect access token I get a 401 error as expected. If I use an incorrect url I get a 404 as expected. I can only assume it's something to do with CORS, since I'm pointing at the right address, I have correct authentication, and I can get back a response in postman.
How do I successful query issues from Jira cloud using javascript in a browser (not nodejs)?