0

Basically, I have developed an angular web application for my company and hosting it on IIS server that requires windows authentication. Server and client both are sitting in corporate network. I am struggling to get client's windows login information in server side when the client logs into my application. How would I do that? Is there any way in javascript that can get me client's login username?

Sarwan
  • 595
  • 3
  • 8
  • 21
  • According to this SO post https://stackoverflow.com/questions/9518092/javascript-how-to-get-the-name-of-the-current-use I don't believe it's possible unless the user explicitly enters their windows user name – Ameer Apr 21 '20 at 14:40

2 Answers2

1

Actually its possible to send windows username using the below flag in angular application:

return this.httpClient.get<UserDetails>(`${this.userInfoUrl}`, { withCredentials: true });

Adding that extra flag after url works for me.

But this is only possible in intra-network(corporate network where Microsoft Active Directory is enabled) and in IIS server windows authentication is enabled. Client and server both are in the same intra-network domain. Please comment if you find anything wrong with this. Please comment if I misunderstood

Sarwan
  • 595
  • 3
  • 8
  • 21
0

Angular(javascript) is a client-side web framework and as such cannot access the user's Windows login info.

Refer this link for more detail:

Get Windows Username within Angular 2/4 application

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26