SnappingOptions with protected featureSources not sending configured apiKey

322
0
01-02-2024 01:47 AM
ViktorSafar
Occasional Contributor II

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