What is httpntlm?
The httpntlm npm package is used to perform HTTP NTLM (NT LAN Manager) authentication. This is particularly useful for interacting with services that require NTLM authentication, such as certain Microsoft services and APIs.
NTLM Authentication
This feature allows you to perform a GET request with NTLM authentication. You need to provide the URL, username, password, workstation, and domain.
const httpntlm = require('httpntlm');
httpntlm.get({
url: 'https://example.com/api',
username: 'yourUsername',
password: 'yourPassword',
workstation: 'yourWorkstation',
domain: 'yourDomain'
}, function (err, res) {
if (err) return console.log(err);
console.log(res.headers);
console.log(res.body);
});
POST Request with NTLM Authentication
This feature allows you to perform a POST request with NTLM authentication. You need to provide the URL, username, password, workstation, domain, request body, and headers.
const httpntlm = require('httpntlm');
httpntlm.post({
url: 'https://example.com/api',
username: 'yourUsername',
password: 'yourPassword',
workstation: 'yourWorkstation',
domain: 'yourDomain',
body: '<xml>yourData</xml>',
headers: {
'Content-Type': 'application/xml'
}
}, function (err, res) {
if (err) return console.log(err);
console.log(res.headers);
console.log(res.body);
});