node.jsntlmntlm-authenticationmicrosoft-dynamics-nav

NTLM authentication for Microsoft Dynamics NAV '18 web service from Node.js fails


I've been struggling with authenticating to NAV '18 from Node server. NTLM authentication works fine from POSTMAN but not from Node. I've already tried using 'Authorization: NTLM', 'username:password' as a header of my request, as well as some NTLM libraries such as httpntlm with no luck.

Is there an actually working example of ntlm authentication with username and password? Changing windows credentials to NAVUserPassword is not an option...


Solution

  • You can use the httpntlm module I wrote a few years ago:

    https://www.npmjs.com/package/httpntlm

    var httpntlm = require('httpntlm');
    
    httpntlm.get({
        url: "https://www.url.to.nav.com",
        username: 'username',
        password: 'password',
        workstation: '',
        domain: ''
    }, function (err, res){
        if(err) return err;
    
        console.log(res.headers);
        console.log(res.body);
    });