Otto Gutierrez
Otto Gutierrez

Reputation: 487

GET and POST request with Windows credentials (Node.js, Electron)

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.

Upvotes: 1

Views: 3730

Answers (1)

josh3736
josh3736

Reputation: 145172

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.

Upvotes: 1

Related Questions