Reputation: 1085
I am trying to get an HTML response after hitting an ASP page. It has NTLM authentication which I tried to resolve using npm-ntlm client. The response is returned from a REST client like postman with NTLM enabled (Auth headers). However, while trying to request the same URL from npm-ntlm in JS, I am receiving the error:
SELF_SIGNED_CERT_IN_CHAIN
Example code:
var options = {
method: 'GET',
username: "user",
password: "password@#",
uri: 'https://URL.com',
rejectUnauthorized: false,
agent: false
};
ntlm_req.request(options).then((res)=>{
console.log("success");
}, (err)=>{
console.log("err");
});
Note: I have tried almost all the methods listed in other answers to fetch a response but unable to get it.
Upvotes: 0
Views: 742
Reputation: 1085
It worked with httpntlm by providing parameters in the following way:
httpntlm.get({
url: url, // complete URL to be fetched
username: 'user',
password: 'pswd',
workstation: 'MachineSerialNo', // host name
domain: ''
}
Upvotes: 1
Reputation: 188
You should try telling the request instance of your ntlm call to ignore ssl issues.
Try this:
var options = {
method: 'GET',
username: "user",
password: "password@#",
uri: 'https://URL.com',
request: {
rejectUnauthorized: false
// or this:
// strictSSL : false
},
agent: false
};
ntlm_req.request(options).then((res)=>{
console.log("success");
}, (err)=>{
console.log("err");
});
Looks to me that you almost got it right :)
You only forgot to pass the request's instance options properly ;)
Upvotes: 1