2

I browsed regarding this question and I couldn't find any better solution. This link has some information for OpenLayers but not for Leaflet.

How do I access a secured WMS via Leaflet in with JavaScript? Do I need to pass user name and password as parameter? Does Leaflet support access to secured WMS server?

1

I found the answer myself after some time.

1) Yes, Leaflet does support access to secured wms server. 2) I included username and password in the url and it worked in chrome and firefox.

L.tileLayer.wms("https://uname:pwd@services.website.com?axyz",{})

Now, I am trying to access the server without exposing username and password in java script and also without using proxy server.

  • 2
    This no longer works in chrome. It blocks requests containing authorisation credentials in the URL for subresources :( – Ryan How Oct 18 '17 at 6:43
  • Any idea of an actual approach for that issue? – Pedraz Apr 1 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.