Home > Blockchain >  How to connect to MS SQL Server using windows authentication of another user with nodeJS mssql
How to connect to MS SQL Server using windows authentication of another user with nodeJS mssql

Time:08-08

I'm using the below code with nodeJS npm mssql 8.1.2 but I get

The login is from an untrusted domain and cannot be used with Windows authentication. SSPI Handshake failed. Error while establishing a connection with Integrated security.

const sql = require('mssql');

let connectionstring = {
     domain: 'abc',
     driver: 'msnodesqlv8',
     server: server,
     user: username,
     password: password,
     database: database,
     options: {
         trustedconnection: true,
         enablearithabort: true,        
         encrypt: true            
     }
 };

How to resolve it?

CodePudding user response:

Most drivers can't use Windows Auth with provided credentials; they support Windows Auth only by using the identity of the current process, or an identity provided by injecting credentials into the Windows Credential store, or injected into the process using runas /netonly.

CodePudding user response:

Sorry. I missed to add /msnodesqlv8 in const sql = require('mssql'). Kindly ignore this question. Thanks @David Browne & Panagiotis Kanavos

  • Related