1

I'm building a NodeJs/Electron app on Windows that needs to send GET and POST requests using my Windows machine credentials. Is there a way to just pass along those credentials without having to ask the user for them?

I want to send the requests from the Nodejs side (server/app) instead of the HTML.

josh3736
  • 139,160
  • 33
  • 216
  • 263
Otto Gutierrez
  • 447
  • 2
  • 5
  • 15

1 Answers1

1

I've answered a similar question before in the context of using regular nodejs as a client.

Unfortunately, that same answer applies to the nodejs part of electron (ie using require('http') or any modules built on top of the node http plumbing). node itself does not speak Windows auth and as of this writing, none of the available native modules implement a Windows integrated auth HTTP client.

However, Chrome itself does support Windows integrated auth, so if you instead use the DOM HTTP APIs (XHR or fetch), you'll likely get the integrated auth for free. (This is a guess; I've never tested it with electron). I know you say you want to send the requests from the node side, but this is the only way to do it at the moment without rolling your own SSPI integration.

josh3736
  • 139,160
  • 33
  • 216
  • 263
  • 2
    Can confirm the Chrome API works within my experience using Electron 2.x and NTLM on the server, with Electron running on Windows OS. Not yet sure of cross platform support but think it should work in theory. – GrahamMc Nov 16 '18 at 13:18
  • 1
    That's good news! For other platforms, I suspect that you'll get the username + password auth popup ("Authentication requried", same as Basic auth). – josh3736 Nov 16 '18 at 19:14