Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 277
rajkiran Avatar asked Feb 08 '23 11:02

rajkiran


2 Answers

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

let options = new RequestOptions({ headers: headers, withCredentials: true });
like image 123
Rohit Avatar answered Feb 10 '23 00:02

Rohit


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

like image 36
T-Heron Avatar answered Feb 10 '23 01:02

T-Heron