I am making a HTTP post request from my angular 6 application to a server to get the authentication token. The server is using basic authentication scheme to validate the username and password before issuing the token. The server responds with 401 unauthorized error if the login username and password are incorrect. Along with 401 error, the server returns www-authenticate: Basic realm={some message} header. The browser automatically pops up a sign in dialog to enter username and password on failed login. I don't want to make any changes in the server, instead I want to handle this popup in my angular application.
I want this popup to be disabled on failed logins and instead I want to handle the error in my angular application itself.
Is that possible?
If yes, how ?