问题
I am trying to read an issue using a https://github.com/steves/node-jira , however I am getting an an error
401: Unable to connect to JIRA during findIssueStatus.
Here is the code that I am using the code bellow on localhost:8433
var jiraApi = require('jira').JiraApi;
var config = {
"username": "name@email.com",
"password": "password",
"port": 443,
"host": "company.atlassian.net"
}
var issueNumber = "ABC-1";
var jira = new jiraApi('https', config.host, config.port, config.username, config.password, '2');
jira.findIssue(issueNumber, function(error, issue) {
console.log('Status: ' + issue.fields.status.name);
});
回答1:
I just found the source to the jira api library and found the error message. Apparently "unable to connect to jira" actually means "unable to find issue".
# Unable to find issue
@jira.request.mostRecentCall.args[1] null, statusCode:401, null
expect(@cb).toHaveBeenCalledWith(
'401: Unable to connect to JIRA during findIssueStatus.')
https://github.com/steves/node-jira/blob/master/spec/jira.spec.coffee
okay, never mind that. I was able to hit the jira api with curl and found I was getting a 403 access denied. It would seem that your login has to have the jira api access turned on so probably that's what's wrong. So it is able to connect, but you're getting kicked out because your login has no access.
来源:https://stackoverflow.com/questions/25279599/authentication-error-401-when-using-node-jira-module