Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
axios-ntlm
Advanced tools
The axios-ntlm package is an HTTP client for Node.js that extends the popular axios library to support NTLM (NT LAN Manager) authentication. This is particularly useful for making HTTP requests to servers that require NTLM authentication, such as certain enterprise environments and legacy systems.
NTLM Authentication
This feature allows you to make HTTP requests with NTLM authentication. The code sample demonstrates how to configure an axios instance with NTLM credentials and make a GET request to a protected resource.
const axios = require('axios');
const axiosNtlm = require('axios-ntlm');
const ntlmOptions = {
username: 'your-username',
password: 'your-password',
domain: 'your-domain'
};
const instance = axios.create();
axiosNtlm(instance, ntlmOptions);
instance.get('http://example.com/protected-resource')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
The httpntlm package is another Node.js library that provides NTLM authentication for HTTP requests. Unlike axios-ntlm, which extends axios, httpntlm is a standalone library. It offers similar functionality but requires more manual setup for making requests.
The node-http-ntlm package is a lightweight library for making HTTP requests with NTLM authentication. It is similar to httpntlm but focuses on simplicity and ease of use. It does not integrate with axios, so it may require more effort to use in projects that already rely on axios.
This is a helper library for NTLM Authentication using the Axios HTTP library on Node. It attaches interceptors to an axios instance to authenticate using NTLM for any resources that offer it.
This example will create you a brand new axios instance you can utilise the same as any other axios instance
import { NtlmClient } from 'axios-ntlm';
(async () => {
let credentials: NtlmCredentials = {
username: 'username',
password: "password",
domain: 'domain'
}
let client = NtlmClient(credentials)
try {
let resp = await client({
url: 'https://protected.site.example.com',
method: 'get'
});
console.log(resp.data);
}
catch (err) {
console.log(err)
console.log("Failed")
}
})()
This shows how to pass in an axios config in the same way that you would when setting up any other axios instance.
Note: If doing this, be aware that http(s)Agents need to be attached to keep the connection alive. If there are none attached already, they will be added. If you are providing your own then you will need to set this up.
import { AxiosRequestConfig } from 'axios';
import { NtlmClient, NtlmCredentials } from 'axios-ntlm';
(async () => {
let credentials: NtlmCredentials = {
username: 'username',
password: "password",
domain: 'domain'
}
let config: AxiosRequestConfig = {
baseURL: 'https://protected.site.example.com',
method: 'get'
}
let client = NtlmClient(credentials, config)
try {
let resp = await client.get('/api/123')
console.log(resp);
}
catch (err) {
console.log(err)
console.log("Failed")
}
})()
FAQs
An NTLM auth extension to the Axios HTTP library
The npm package axios-ntlm receives a total of 221,170 weekly downloads. As such, axios-ntlm popularity was classified as popular.
We found that axios-ntlm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.