<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SnappingOptions with protected featureSources not sending configured apiKey in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snappingoptions-with-protected-featuresources-not/m-p/1365283#M83234</link>
    <description>&lt;P&gt;Map with a FeatureLayer pointing to a protected source:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayer =  new FeatureLayer({
	url: protectedServiceUrl,
	apiKey: apiKey,
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sketch with snappingOptions using that layer as a featureSource:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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 }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_0-1704188471036.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/90240i316A3F704B2E4BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_0-1704188471036.png" alt="ViktorSafar_0-1704188471036.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;PoC here (you need your own protected service and your own API key)&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/viktor-safar-geodata/pen/dyrYmaP" target="_blank" rel="noopener"&gt;https://codepen.io/viktor-safar-geodata/pen/dyrYmaP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We know we can use esri request interceptors to append the token manually, but is this expected behaviour or a bug?&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jan 2024 09:50:44 GMT</pubDate>
    <dc:creator>ViktorSafar</dc:creator>
    <dc:date>2024-01-02T09:50:44Z</dc:date>
    <item>
      <title>SnappingOptions with protected featureSources not sending configured apiKey</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snappingoptions-with-protected-featuresources-not/m-p/1365283#M83234</link>
      <description>&lt;P&gt;Map with a FeatureLayer pointing to a protected source:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayer =  new FeatureLayer({
	url: protectedServiceUrl,
	apiKey: apiKey,
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sketch with snappingOptions using that layer as a featureSource:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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 }]
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_0-1704188471036.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/90240i316A3F704B2E4BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_0-1704188471036.png" alt="ViktorSafar_0-1704188471036.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;PoC here (you need your own protected service and your own API key)&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/viktor-safar-geodata/pen/dyrYmaP" target="_blank" rel="noopener"&gt;https://codepen.io/viktor-safar-geodata/pen/dyrYmaP&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We know we can use esri request interceptors to append the token manually, but is this expected behaviour or a bug?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2024 09:50:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/snappingoptions-with-protected-featuresources-not/m-p/1365283#M83234</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2024-01-02T09:50:44Z</dc:date>
    </item>
  </channel>
</rss>

