Select to view content in your preferred language

Problem adding a SECURED OGC WMS to map

1020
0
05-19-2021 07:08 AM
mattigis
New Contributor

Hey guys,

we would like to add a secured OGC WMS to a map of the ArcGIS API for JavaScrip. 

Regarding to "Access secure resources" (https://developers.arcgis.com/javascript/latest/secure-resources/) it is possible to access a WMS with "Network Credentials".

But unfortunately when we add a secured WMS to the map no popup from the browser appears:

const layer = new WMSLayer({
url: url_of_wms,
sublayers: [
{
name: "name_of_layer"
}
]
});

const map = new Map({
basemap: {
baseLayers: [layer]
}
});

 

But when we do a request a pup is showing up (username, password):

esriRequest(url_of_wms, {
withCredentials: true
}).then(function (response) {
console.log(response);
});

 

But I still get an authorization error (401) while adding the WMS to the map, because it doesn't add an authentication header to the request.

 

So, here is our question: How can we add a secured OGC WMS to the map?

Thanks 🙂

0 Replies