简体   繁体   中英

NTLM authentication using Angular2

In my client web application, I need to authenticate with the server using ntlm protocol. While using Angular1, with the $http service get request, the browsers (chrome, edge) were doing all the 3 steps of the NTLM authentication by prompting user for username/password.

However, with Angular2, using the http service that comes with Angular2, the browser (chrome,edge) just return 401 and do not do the subsequent steps (they do not even prompt the user for credentials).

How do I make browser do the ntlm authentication for me while using Angular2 ? Please do not suggest the ntlm javascript library. I'm new to StackOverflow. If I haven't given sufficient info or repeated the question, sorry about that.

Thanks in Advance.

"withCredentials" needs to set true in headers to make it work. My code is working now.

let options = new RequestOptions({ headers: headers, withCredentials: true });

I don't believe the problem is with NTLM or in your coding efforts. According to Anton Bessonov, a very reputable SO community member, some modules in Angular2 are just not production-ready yet, while Angular1 is a very stable code release, and my advise is to stick with Angular1 that for the foreseeable future. Ref: angular 1 vs angular 2 for new project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM