SamDecrock / node-http-ntlm

Node.js module to authenticate using HTTP NTLM
MIT License
192 stars 89 forks source link

Allowing/Following redirect #2

Closed bahit closed 9 years ago

bahit commented 10 years ago

I tried your example code and somehow it works, but using other test seems like the website that uses NTLM that I'm trying to access uses a 301 redirect and using the example as it is didn't quite get to the page I wanted since it stopped and didn't followed the redirect.

Looking at your code inside httpntlm.js, I noticed you used the option

allowRedirects: false,

for httpreq. Changing that to true, followed the redirect but some how I get a 401 error.

How can keep the authentication alive while following a redirect. (I know I'm authenticated and NTLM side working since I'm getting the redirect).

SamDecrock commented 10 years ago

That's because httpreq doesn't forward the cookies when redirecting... maybe I should fix that one time :-)

I suggest you parse the headers yourself, get the redirect location, get the cookies and use those cookies to go to that new location yourself.

SamDecrock commented 9 years ago

See #12 for an example