Select to view content in your preferred language

SnappingOptions with protected featureSources not sending configured apiKey

407
0
01-02-2024 01:47 AM
ViktorSafar
Frequent Contributor

Map with a FeatureLayer pointing to a protected source:

 

const featureLayer =  new FeatureLayer({
	url: protectedServiceUrl,
	apiKey: apiKey,
});

 

Sketch with snappingOptions using that layer as a featureSource:

 

const sketch = new Sketch({
  layer: graphicsLayer,
  view: view,
  creationMode: "create",
  snappingOptions: { // autocasts to SnappingOptions()
	enabled: true, // global snapping is turned on
	featureSources: [{ layer: featureLayer, enabled: true }]
  }
});

 

 

The feature layer loads fine (red outline in the image below), however the queries created by snappingOptions do not append the configured apiKey resulting in a logon popup

ViktorSafar_0-1704188471036.png

PoC here (you need your own protected service and your own API key)

https://codepen.io/viktor-safar-geodata/pen/dyrYmaP 

 

 

We know we can use esri request interceptors to append the token manually, but is this expected behaviour or a bug?

0 Kudos
0 Replies