<?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 Failed to load public ESRI layer when referrer is set in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/failed-to-load-public-esri-layer-when-referrer-is/m-p/1376412#M83501</link>
    <description>&lt;P&gt;Hi all, I've been using ESRI's USA Census Tracts layer for lots of my applications (it's public and hosted by esri, not me):&amp;nbsp;&lt;A href="https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tracts/FeatureServer" target="_blank"&gt;https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tracts/FeatureServer&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;It's been loading fine in my apps until I added a referrer to the api key (so the api calls are restricted to my company's hosting server / can't be used elsewhere). When I set this, the layer now fails to load and gives me some error codes and messages:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;httpStatus: 498&lt;/LI&gt;&lt;LI&gt;messages: Invalid token.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ranico_0-1706708131208.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93279iB125E962F6D99276/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ranico_0-1706708131208.png" alt="ranico_0-1706708131208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried loading it with the new api key assigned in the feature layer token property and without assigning it - the same error happens. Can someone explain why this might be happening? I have a feeling it might have to do with setting the content item scopes but since this is external data, it's not really something I can set and I don't know a way around this.&lt;/P&gt;&lt;P&gt;Any advice is appreciated :).&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2024 13:45:10 GMT</pubDate>
    <dc:creator>ranico</dc:creator>
    <dc:date>2024-01-31T13:45:10Z</dc:date>
    <item>
      <title>Failed to load public ESRI layer when referrer is set</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/failed-to-load-public-esri-layer-when-referrer-is/m-p/1376412#M83501</link>
      <description>&lt;P&gt;Hi all, I've been using ESRI's USA Census Tracts layer for lots of my applications (it's public and hosted by esri, not me):&amp;nbsp;&lt;A href="https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tracts/FeatureServer" target="_blank"&gt;https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tracts/FeatureServer&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;It's been loading fine in my apps until I added a referrer to the api key (so the api calls are restricted to my company's hosting server / can't be used elsewhere). When I set this, the layer now fails to load and gives me some error codes and messages:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;httpStatus: 498&lt;/LI&gt;&lt;LI&gt;messages: Invalid token.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ranico_0-1706708131208.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93279iB125E962F6D99276/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ranico_0-1706708131208.png" alt="ranico_0-1706708131208.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried loading it with the new api key assigned in the feature layer token property and without assigning it - the same error happens. Can someone explain why this might be happening? I have a feeling it might have to do with setting the content item scopes but since this is external data, it's not really something I can set and I don't know a way around this.&lt;/P&gt;&lt;P&gt;Any advice is appreciated :).&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 13:45:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/failed-to-load-public-esri-layer-when-referrer-is/m-p/1376412#M83501</guid>
      <dc:creator>ranico</dc:creator>
      <dc:date>2024-01-31T13:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to load public ESRI layer when referrer is set</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/failed-to-load-public-esri-layer-when-referrer-is/m-p/1377337#M83523</link>
      <description>&lt;P&gt;I think the issue has to do with me assigning the restricted api key to the esri config variable:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;esriConfig&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;apiKey = 'PRIVATEAPI';&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;This is because when I check the api request being made when the page loads, it's automatically assigning the private api key as a token for this layer:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;I don't want to copy and paste the specific request here because it contains the api key, but I think I just need the request to be made without a token assigned. One other option is creating two api keys - a restricted one and non-restricted one to assign instead but I really don't want to host a public api key for security reasons. I'd rather just have no key be passed at all for this later since it's a publicly hosted layer. Is this possible?&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 01 Feb 2024 22:19:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/failed-to-load-public-esri-layer-when-referrer-is/m-p/1377337#M83523</guid>
      <dc:creator>ranico</dc:creator>
      <dc:date>2024-02-01T22:19:35Z</dc:date>
    </item>
  </channel>
</rss>

