Tedious: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Created on 10 Dec 2018  ·  6Comments  ·  Source: tediousjs/tedious

I am using tedious 3.0.1 to connect sql server, I want to use windows authentication, my config looks like this,
var config = {
domain: 'XXXXCLOUD',
userName: 'XX_SA_XX_XXXX_XX',
password: "my pass"
server: 'XX-ZU2SQLXXX.XXXXCLOUD.com',
options: {
database: 'dbname',
encrypt: true,
port: 1433
}
}
After run command, I got "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication." error.
The sql server I am trying to connect is : sql server 2016
I am using runas command like below in my local machine, so I can try to login with correct domain:
runas /netonly /env /user:XXXXCLOUD\XX_SA_XX_XXXX_XX "node tediousClientConnect" (tediousClientConnect is my node client app which using tedious to connect sql)

Can anyone help to provide a solution on this ?

Idle

Most helpful comment

Sometimes the server requires passing through the workstation name as well. Unfortunately, we currently don't expose that option. I'll see if I can open a PR to allow this, and maybe you can then see if that helps you in your case.

Sorry you're facing this trouble. 🙇

All 6 comments

@gladmustang I am not able to help with this info 🤷‍♀️ but the error is telling what could be the potential issue. are you able to connect to the server using SSMS with the same config? if you're able to run the same script using runas then the issue should be in env setup not in tedious

Hi Hadis-Fard,
I can use SSMS with the same command, so I think it will not be the env issue.
runas /netonly /env /user:XXXXCLOUD\XX_SA_XX_XXXX_XX ssms
Also, I tried msnodesqlv8 with similiar command, and I can connect to remote DB, so I think it should not be the env issue. Do you need me to provide other information that may help you to track issue ?

Sometimes the server requires passing through the workstation name as well. Unfortunately, we currently don't expose that option. I'll see if I can open a PR to allow this, and maybe you can then see if that helps you in your case.

Sorry you're facing this trouble. 🙇

Hi arthurschreiber,
Thanks for response and help, waiting for your further update.

I might be facing the same issue

Hi @gladmustang, are you still facing the same issue with the latest tedious version?

Was this page helpful?
0 / 5 - 0 ratings