This is my Node JS code:
const jiraApi = require('jira-client');
var jira = new jiraApi({protocol: 'https',
host: 'jira.XXXX.global',
username: 'myUsername',
password: 'myPassword',
apiVersion: '2'});
jira.findIssue('myIssueNumber').then(() => {
console.log(`Status: ${issue.fields.status.name}`
)}).catch((error) => {
console.log(error)});
I expect to see issue.fields.status.name in my terminal but I encounter Request failed with status code 401.
I am sure my username and password are correct because I can access JIRA application via chrome and I can see the detail of this IssueNumber.
I don't know why I encounter 401 error. Can anyone help me?