Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use Windows authentication to connect to MSSQL #302

Closed
NamTThai opened this issue Aug 14, 2015 · 11 comments
Closed

Unable to use Windows authentication to connect to MSSQL #302

NamTThai opened this issue Aug 14, 2015 · 11 comments

Comments

@NamTThai
Copy link

I have not had much luck with connecting to MSSQL using windows authentication so far.

This is my config:

var config = {
"userName": "username",
"password": "password",
"domain": "domain"
"server": "server",

"options": {
  "encrypt": true
}
}

I can log in to that server with domain\username and password, but I cannot authenticate using tedious. I tried out tedious-ntlm without much luck either. I don't even need windows authentication, btw. As long as tedious can talk to the domain and authenticate using provided username, I would be golden. I don't understand why it cannot communicate with the domain. I put the node.js script on the same server.

@arthurschreiber
Copy link
Collaborator

I think I saw something in the NTLM authentication code in tedious that made it impossible to use in combination with encrypted connections. Could you try with the 'encrypt' option set to 'false'?

@NamTThai
Copy link
Author

It still doesn't work :(

@NamTThai
Copy link
Author

This is the error log when encrypt: true

{"name":"ConnectionError","message":"Failed to connect to 172.20.1.54:1433 in 15000ms","code":"ETIMEOUT"}

And when encrypt: false

{"name":"ConnectionError","message":"Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.","code":"ELOGIN"}

@NamTThai
Copy link
Author

What I don't quite understand is this: After the failed connection, if I send a request, this error message shows up:

"error":"Requests can only be made in the LoggedIn state, not the SentLogin7WithStandardLogin state"

Which is rather strange, because I thought if I specified a "domain" then I should enter state SentLogin7WithNTLM instead of Standard login

@arthurschreiber
Copy link
Collaborator

As I said, I don't think encrypt is compatible with domain logins (yet). Is this on SQL server 2014? If yes, domain logins don't work yet on that version. :(

@NamTThai
Copy link
Author

This is SQL Server 2008 only :s I thought that tedious support NTLM? #134

@NamTThai
Copy link
Author

Do you know any way at all, any module, that supports NTLM/WIndows authentication on SQL server 2008?

I tried windows' driver for node.js, but it only support SQL server 2012 and up.
I tried seriate, but I ran into the same problem: Login is from untrusted domain ...

@arthurschreiber
Copy link
Collaborator

I can't promise anything, but I'll try to take a look. We definitely want tedious to support NTLM based authentication on all relevant versions of SQL Server, but the implementation is tricky and I have not spend enough time on this topic yet.

@arobson
Copy link
Contributor

arobson commented Aug 15, 2015

@NamTThai - please look at the comments I just made on issue #246. I believe it's likely how you're providing credentials. Even when they're technically right, the handshake is really sensitive and that error message is bogus. Take note of next steps section - more information would help a lot.

@aaroncalderon
Copy link

I was having simmilar problem. My solution was to use capital letters for the domain and non qualified domain, see #246 (comment)

@tvrprasad
Copy link
Contributor

This is fixed in #417
FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants