Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ax-ntlm

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ax-ntlm

An NTLM auth extension to the Axios HTTP library

  • 1.4.2
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-88.73%
Maintainers
0
Weekly downloads
 
Created
Source

Axios-NTLM

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.

Examples

Basic example

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")
    }

})()

With a custom Axios config

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")
    }

})()

Keywords

FAQs

Package last updated on 03 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc