NodeSSPI
NodeSSPI copied to clipboard
Sending request to nodeSSPI on a remote server via XHR?
@abbr I added the nodeSSPI Api call to an express server on a remote machine. Everything works fine on a local host request via Ajax from the browser and the user's name is returned from req.connection.user;
But when I deploy the express server to a remote machine outside our domain. The server denies the GET request from the browser to the nodeSSPI Api on the express server -app.get('/OOO/UserLDAP', UserLDAP.Authenticate);
giving back a 401 error-
Failed to load resource: the server responded with a status of 401 (Unauthorized)
Do I need to pass basic auth credentials in the xhr request in order for nodeSSPI Api to return NT name? As I said the 401 only returns when I move the express server to another domain machine.
Or can the NT user name be retrieved from the API without passing the credentials in the request header?
In my case I just need the user's NT login name to pass onto another internal LDAP request server. This is a gist of my express server's setup as is:
https://jsfiddle.net/brianVarley/tf1puukp/
i have the same issue but both of my machines are on the same domain. requests to localhost authenticate as expected, but remote requests are prompted for basic auth and are rejected regardless if a correct password is supplied.
@zcmack Yes same today I changed my solution to setCredentials=true in the XHR request. Which in turn prompts for basic auth when I send a request to the remote express server. Supplying the correct credentials to the basic auth pop up are rejected. Thus giving back the 403.
In contrast with that when I send the request to the server run on local the basic auth popup accepts my credentials and returns expected Json result.
Hoping to hear something back on here as to why this doesn't work when deployed to a remote server. :)
Is primary web page's host name same as xhr's?