We have a web application with session and basic auth, the web user interface is fetching data from the API.
The API should be accessed with basic auth (for technical users) and with session authentication.
Now, if the user session of the web application times out and the user is doing any action, fetch
tries to fetch data from the API, and as the authentication is not valid any more, it gets an HTTP 401 with the HTTP header WWW-Authenticate: Basic realm="Realm"
.
This is causing the browser to show up the basic auth dialog.
I do not want to show this dialog to users, I would like fetch
to ignore the WWW-Authenticate
header and redirect to the login page.
Is it possible to ignore the WWW-Authenticate
somehow?
Or do I have to configure the API endpoints not to return the basic auth header?