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
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?