I’m trying to integrate Jira with a Slack app and am having trouble with the Jira’s REST API. I’m using the basic auth for the sake of simplicity, as I simply want to fetch projects. I’ve created an API token and granted project permissions via the default project permissions scheme with both browse projects and administrate projects options selected. My request returns a 401 Unauthorized error with the message: “Basic authentication with passwords is deprecated.”
Based on other suggestions, I tried resetting my password but that did not help.
Here is my code:
fetch('https://<domain>.atlassian.net/rest/api/2/project/search', {
method: 'GET',
headers: {
'Authorization': `Basic ${Buffer.from(
`<myEmail>:${process.env.JIRA_KEY}`
).toString('base64')}`,
'Accept': 'application/json'
}
})
.then(response => {
console.log(
`Response: ${response.status} ${response.statusText}`
);
return response.text();
})
.then(text => console.log(text))
.catch(err => console.error(err));