Javascript using native browser authentication
<p>I am currently developing a web-application using Angular2 with TypeScript (if that matters).<br>
This application has to communicate with a webserver, which is asking for a digest authentication.<br>
Until now i was using the native login prompt of the browsers, which is automatically showing, when the server returns a "401 unauthorized". The browser only asks for authentication once and automatically uses this username and password for future requests. So I don't have to take care about the authentication, the browser does everything for me.<br>
Unfortunately now i have to create a custom login screen, as i have to implement some default actions, such as "register" or "reset passwort", which are ususally accessible from that screen.<br>
As digest authentication is quite complex and the browser would allready do all the complex things for me I would like to continue using the browsers functionality, but without using it's login prompt.<br>
So is it possible to use the browsers authentication functionality?<br>
If it is possible, how can I set the username and the password it should use?</p>

<p><strong>EDIT:</strong><br>
As someone wanted to close this question as "to broad", i'll try to add some more detail.<br>
The web-application gets data from a restful webservice. This webservice requires digest authentication and responds with a 401, if you are using a wrong username or password.<br>
As mentioned above, the browser automatically shows a login prompt, if he gets a 401 error. If you enter a valid login, the browser caches those values somewhere and automatically sets them for every future request.<br>
Now i basicly want to replace the login prompt and programatically set the values the browser should use for the login.<br>
I hope this helps to make the question clear.</p>