I'm using Leaflet to display map tiles. The map tiles are loaded from a different site using basic authentication.
So the url template looks like this: L.tileLayer('https://username:password@example.com/tiles/{z}/{x}/{y}.png')
Unfortunately this results in map tiles not loading, since e.g. Internet Explorer just ignores the username and password in web site adresses.
Is there a way to succesfully authenticate the Leaflet map tile requests without using a proxy but still using basic authentication?
Best Answer
Without knowing the tile provider, hard to tell how to best to structure the URL call. A workaround could simply be to use a similar tile service... here's a bunch that show both preview and the
L.tileLayer
configurations:https://leaflet-extras.github.io/leaflet-providers/preview/