After creating an https demo of a small web app on my local system, I decided to deploy it behind Basic Authentication due to its private nature.
An issue arose when using the Fetch API in the app. Initially, I assumed that fetch()
would inherit the Basic Authentication from the base page, but it appears that the fetch API does not have this capability.
While I am familiar with how to generate the required Basic Authentication headers for fetch, I am now faced with a different question:
How can I pass on the Basic Authentication credentials of the base page to the fetch API?
The reason behind this query is that I want to keep the app simple without adding a complex Basic Authentication configuration. Additionally, I do not wish to embed the credentials directly into the demo. My goal is to simply inherit the credentials from the originating base page where the fetch requests are made.