-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
NodeSSPI called several times in one request #64
Comments
If host name of backend and frontend is different, there could be an option preflight request according to CORS. NTLM auth has at least 2 round trips. Therefore 3 times seems OK to me. |
Thanks for your answer. Something like Express Session wouldn't work in development mode since afaik it only works if frontend and backend are on the same host which isn't the case. I could maybe use a JSON WebToken. But with the other issue #53 where some groups are missing I'd probably need to add another ldap module to check the if the user is a member of the groups I need him to be a member of and therefore I could just deactivate the retrieveGroups option which should lead to less stress on the AD server. |
Looks like one part problem solved itself for me. Now I still need to find a way to get the specified groups the authenticated user is part of. But I guess I need to do it without Node-SSPI. Thanks for your help and explanations. |
I was facing the same problem of having multiple requests per request from browser. From what I read here, an unofficial document of how MS NTLM handshakes work, I finally see why would there be at least 3 requests came into my server (and that's making node-sspi fairly difficult to migrate with some other node modules that's making use of the request/response pair). It's pretty much how MS NTLM works, but apparently browsers don't show a thing about the handshakes behind-the-scene. TL;DR: It's how the NTLM protocol works, those are the required handshakes and they are not shown in the development tools of your browsers. |
I have this exact same issue. I get that's how NTLM handshaking works, but it's calling my POST methods 3 times. This executes database writes 3 times over instead of handshaking first, then continuing. Frustrating! |
Hi,
I'm using NodeSSPI as a global middleware in my Express backend (port 3000) just like in your example alongside an Angular frontend (port 4200). I added a console.log(err) inside the nodeSSPIObj.authenticate to see what the error is like.
Now everytime I make a call to the backend I get at least 3 times "undefined" in the express console which means the middleware is called that many times during a single call. No matter what browser I use (IE, Firefox or Chrome).
Then I made a simple test and created a test route in the backend and even if I call it directly with localhost:3000/test NodeSSPI is called 3 times. And at least once on every reload or if I go to another route manually.
Is this expected the behaviour? I was under the impression it should only be called once when you call the backend the first time and because perRequestAuth is set to false on default it shouldn't be called again after that until you restart the browser.
Afterall if retrieveGroups is set to true it would also be called on each of the 3+ initial calls and on all other calls later.
Or am I not understandig the way it should work?
The text was updated successfully, but these errors were encountered: