Angular login visible in the request header

0

Well, good afternoon.

I need some help. My backend was written in nodejs and is in IIS. My frontend is angular and still in my machine being debugged. My login page is working as expected, connecting seamlessly. But when the application sends the request to the backend it is possible to get the username and password both via browser and using wireshark. How can I hide this information? Example: When we use the browser login box for this type of authentication, it does not make the login information and password visible.

My code:

login(username: string, password: string): Observable<User> {

     const body = { username: username, password: password };
     const headers = new HttpHeaders();
     headers.append("Authorization", "Basic " + btoa("username:password"));
     headers.append("Content-Type", "application/x-www-form-urlencoded");

     return this.http
               .post<User>('${BASE_URL}/sign-in', body, { headers: headers })
               .do(user => (this.user = user));
}

wireshark image after login in application:

    
asked by anonymous 06.03.2018 / 19:49

1 answer

0

To hide this information you need to install an SSL certificate on your backend. The certificate works by encrypting the data between the server and the client.

  

The SSL protocol provides privacy and data integrity between   two applications that communicate over the internet. This is due to   authentication of the parties involved and the encryption of the   data transmitted between the parties. Furthermore, this protocol   to prevent intermediaries between the two ends of   misappropriation or falsify the data   are being transmitted [...]. source: Wikipedia

There are several types and levels of SSL certificates as well as multiple certificates.

A free one, which I even use, is LetsEncrypt .

How to configure on nodejs: link

    
07.03.2018 / 20:16