<?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 CORS Error loading webmap with Windows Auth that uses external Registered Layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-error-loading-webmap-with-windows-auth-that/m-p/1277056#M80817</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My customer in this application has ArcGIS Enterprise Portal with Integrated Windows Authentication. I am trying to display for their users a Web Map using the Javascript API. My code is quite simple:&lt;/P&gt;&lt;P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;            esriId.getCredential(portalUrl + "/sharing").then(() =&amp;gt; {
                const webmap = new WebMap({
                    portalItem: {
                        id: itemId,
                        portal: {
                            url: portalUrl
                        }
                    }
                });

                const view = new MapView({
                    container: "viewDiv",
                    map: webmap

                });
            );&lt;/LI-CODE&gt;&lt;P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code correctly displays the map and starts loading the various layers configured in the Web Map. Some of those layers are actually registered items pointing to a Feature service hosted on another site. And the item has been configured with stored credentials. The end user does &lt;U&gt;not&lt;/U&gt; have their own credentials for the external site. For some of the layers this works fine, but for those hosted on ArcGIS Online, I'm seeing this error:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Failed to load&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://customersite.domain.com/customerportal/sharing/servers/1d84b0de9cf1445f8c6bf5d1320cb50d/rest/services/Service_Name/FeatureServer/0?f=json" target="_blank" rel="noopener"&gt;https://customersite.domain.com/customerportal/sharing/servers/1d84b0de9cf1445f8c6bf5d1320cb50d/rest/services/Service_Name/FeatureServer/0?f=json&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I confirmed that the value for Access-Control-Allow-Origin is in fact *, which seems to usually be the case when loading data from ArcGIS Online. That's a problem here though, because with Integrated Windows Authentication, the portal requires credentials to be passed. For other requests, ie where the source URL is not AGOL,&amp;nbsp; it's actually returning my own site as the allowed origin, which works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This may be an unusual configuration, but is there a way to make it work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Apr 2023 20:45:33 GMT</pubDate>
    <dc:creator>DanielDormont</dc:creator>
    <dc:date>2023-04-10T20:45:33Z</dc:date>
    <item>
      <title>CORS Error loading webmap with Windows Auth that uses external Registered Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-error-loading-webmap-with-windows-auth-that/m-p/1277056#M80817</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;My customer in this application has ArcGIS Enterprise Portal with Integrated Windows Authentication. I am trying to display for their users a Web Map using the Javascript API. My code is quite simple:&lt;/P&gt;&lt;P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;            esriId.getCredential(portalUrl + "/sharing").then(() =&amp;gt; {
                const webmap = new WebMap({
                    portalItem: {
                        id: itemId,
                        portal: {
                            url: portalUrl
                        }
                    }
                });

                const view = new MapView({
                    container: "viewDiv",
                    map: webmap

                });
            );&lt;/LI-CODE&gt;&lt;P&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code correctly displays the map and starts loading the various layers configured in the Web Map. Some of those layers are actually registered items pointing to a Feature service hosted on another site. And the item has been configured with stored credentials. The end user does &lt;U&gt;not&lt;/U&gt; have their own credentials for the external site. For some of the layers this works fine, but for those hosted on ArcGIS Online, I'm seeing this error:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Failed to load&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://customersite.domain.com/customerportal/sharing/servers/1d84b0de9cf1445f8c6bf5d1320cb50d/rest/services/Service_Name/FeatureServer/0?f=json" target="_blank" rel="noopener"&gt;https://customersite.domain.com/customerportal/sharing/servers/1d84b0de9cf1445f8c6bf5d1320cb50d/rest/services/Service_Name/FeatureServer/0?f=json&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I confirmed that the value for Access-Control-Allow-Origin is in fact *, which seems to usually be the case when loading data from ArcGIS Online. That's a problem here though, because with Integrated Windows Authentication, the portal requires credentials to be passed. For other requests, ie where the source URL is not AGOL,&amp;nbsp; it's actually returning my own site as the allowed origin, which works.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This may be an unusual configuration, but is there a way to make it work?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 20:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-error-loading-webmap-with-windows-auth-that/m-p/1277056#M80817</guid>
      <dc:creator>DanielDormont</dc:creator>
      <dc:date>2023-04-10T20:45:33Z</dc:date>
    </item>
  </channel>
</rss>

