<?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 Re: Adding non-public AGOL feature layers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335724#M82413</link>
    <description>&lt;P&gt;Organization accounts are different from developer accounts. Org accounts should not be using API keys. That's why you don't have that option. Sorry, it may not be completely clear in all the doc, but org accounts should be using OAuth.&lt;/P&gt;&lt;P&gt;Info: here:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/secure-resources/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/secure-resources/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2023 11:37:09 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2023-10-06T11:37:09Z</dc:date>
    <item>
      <title>Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335332#M82405</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Newb question on the Javascript SDK - first time playing around to see what I can do with it, and falling at the first hurdle...&lt;/P&gt;&lt;P&gt;I've followed &lt;A href="https://developers.arcgis.com/javascript/latest/add-a-feature-layer/" target="_self"&gt;this tutorial&lt;/A&gt; on how to add a feature layer to a map, but using a non-public layer that is hosted by my ArcGIS Online account (where the API key is also coming from).&lt;/P&gt;&lt;P&gt;Everything works, except for the feature layer, which doesn't display.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TimF_0-1696508877332.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82373iC4C6B94E8432DFD3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TimF_0-1696508877332.png" alt="TimF_0-1696508877332.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Checking the response in developer tools for the feature layer and I can see the following error:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;{"error":{"code":403,"message":"You do not have permissions to access this resource or perform this operation.","messageCode":"GWM_0003","details":["You do not have permissions to access this resource or perform this operation."]}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit confused by this, as the feature layer is owned by the same account that the API key is tied to. So I assumed it wouldn't have any permissions issues or need for additional tokens. No doubt I'm just fundamentally misunderstanding how this should work!&lt;/P&gt;&lt;P&gt;Can anyone put me straight on this? How can I get my non-public AGOL feature layer into a JS SDK map?&lt;/P&gt;&lt;P&gt;Full code below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /&amp;gt;
    &amp;lt;title&amp;gt;ArcGIS Maps SDK for JavaScript Tutorials: Display a map&amp;lt;/title&amp;gt;

    &amp;lt;style&amp;gt;
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    &amp;lt;/style&amp;gt;
	
	&amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.27/esri/themes/light/main.css"&amp;gt;
    &amp;lt;script src="https://js.arcgis.com/4.27/"&amp;gt;&amp;lt;/script&amp;gt;
	
	&amp;lt;script&amp;gt;
      require(["esri/config", "esri/Map", "esri/views/MapView", "esri/layers/FeatureLayer"], function(esriConfig, Map, MapView,FeatureLayer) {
	  
	    esriConfig.apiKey = redacted;

        const map = new Map({
          basemap: "arcgis-topographic" // Basemap layer service
        });
		
		const view = new MapView({
          map: map,
          center: [-1.7468262, 53.826597], // Longitude, latitude
          zoom: 6, // Zoom level
          container: "viewDiv" // Div element
        });
		
		// Layer
        const cLayer = new FeatureLayer({
          url: "https://services2.arcgis.com/redacted/FeatureServer/0"
        });
		
		map.add(cLayer,0);
      });
	  
    &amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 12:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335332#M82405</guid>
      <dc:creator>TimF</dc:creator>
      <dc:date>2023-10-05T12:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335343#M82406</link>
      <description>&lt;P&gt;Have you tried applying the API key to the layer itself?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#apiKey" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#apiKey&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 13:08:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335343#M82406</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-10-05T13:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335351#M82407</link>
      <description>&lt;P&gt;Did you add the layer to your API key scope in the API Key management console?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ReneRubalcava_0-1696513570900.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/82374i7FA66F00962E9FCB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ReneRubalcava_0-1696513570900.png" alt="ReneRubalcava_0-1696513570900.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Layers via API Keys is still a beta feature, but you can try it out.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/#private-content-items" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/#private-content-items&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 13:47:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335351#M82407</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-10-05T13:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335691#M82410</link>
      <description>&lt;P&gt;Thanks for the suggestion - sadly that didn't work. Applying the API key at that level (in addition to or in replacement of the primary key) just seems to kill everything and only returns a blank screen &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 08:31:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335691#M82410</guid>
      <dc:creator>TimF</dc:creator>
      <dc:date>2023-10-06T08:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335697#M82412</link>
      <description>&lt;P&gt;Thanks for the suggestion - I can't seem to see that scope, but I'm wondering if that's because my developer account is an ArcGIS Online organisation administrator account, as opposed to a standalone developer account.&lt;/P&gt;&lt;P&gt;I also note when I follow that link it says' ArcGIS Online accounts cannot be used to access private content items in ArcGIS'. I don't 100% follow that, but perhaps that means I can't do what I'm trying to do without sharing the layer publicly? i.e. any other form of sharing is deemed 'private', including organisational content, which is what this is.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 08:39:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335697#M82412</guid>
      <dc:creator>TimF</dc:creator>
      <dc:date>2023-10-06T08:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335724#M82413</link>
      <description>&lt;P&gt;Organization accounts are different from developer accounts. Org accounts should not be using API keys. That's why you don't have that option. Sorry, it may not be completely clear in all the doc, but org accounts should be using OAuth.&lt;/P&gt;&lt;P&gt;Info: here:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/secure-resources/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/secure-resources/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 11:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335724#M82413</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-10-06T11:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding non-public AGOL feature layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335823#M82415</link>
      <description>&lt;P&gt;Thanks, yes that is coming clearer now!&lt;/P&gt;&lt;P&gt;Just one final question - I didn't cover the use-case - but effectively the idea was it would be really handy to have a basic application, displaying a single key non-public layer, company-wide - without warranting AGOL accounts for everyone.&lt;/P&gt;&lt;P&gt;If I understand OAuth correctly, this isn't possible is it? As it would place authentication at the account level - and accounts can't be shared, so there's no point continuing this! That's why the API method seemed like a nice solution, if it worked.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 16:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/adding-non-public-agol-feature-layers/m-p/1335823#M82415</guid>
      <dc:creator>TimF</dc:creator>
      <dc:date>2023-10-06T16:13:37Z</dc:date>
    </item>
  </channel>
</rss>

