mardi 4 mars 2014

HTTP basic authentication failing with request module in a JIRA server


Vote count:

0




I'm building a simple node.js app that is going to make requests to a JIRA , and for that I need to be authenticated. For now, I'm running the JIRA server on my local machine.


I'm using the request module to make my requests. Here's an example of a simple request that I'm trying to do:



function callback(error, response, body) {
if (!error && response.statusCode == 200) {
var json = JSON.parse(body);
return json;
}
}

request.get('http://localhost:8080/an_issue_path', callback).auth(username, password, false);


The problem is that I'm just receiving a 401, with the error message:


{"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}.


But, what I don't understand is that when I do a curl request, like this:


curl -u username:password http://localhost:8080/an_issue_path


, I get a 200 with the correct json.


What am I doing wrong?



asked 41 secs ago






2 commentaires:

  1. Did you ever figure it out? Having the exact same issue now

    RépondreSupprimer
  2. Did you ever figure it out? Having the exact same issue now

    RépondreSupprimer