<?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: Authenticate ArcGIS on premise in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1491987#M84860</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Seems like you have esriRequest and esriConfig incorrectly configured, along with missing references. Try this instead:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;require(["esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/Search",&lt;BR /&gt;"esri/identity/IdentityManager",&lt;BR /&gt;"esri/identity/ServerInfo",&lt;BR /&gt;"esri/request",&lt;BR /&gt;"esri/config"], (&lt;STRONG&gt;EsriMap&lt;/STRONG&gt;, MapView, Search, IdentityManager, &lt;STRONG&gt;ServerInfo,&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;esriRequest, esriConfig&lt;/STRONG&gt;) =&amp;gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 18:38:18 GMT</pubDate>
    <dc:creator>JohnGrayson</dc:creator>
    <dc:date>2024-06-13T18:38:18Z</dc:date>
    <item>
      <title>Authenticate ArcGIS on premise</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478751#M84721</link>
      <description>&lt;P&gt;I tried to do an auth. by using&amp;nbsp;esriRequest.interceptors.push, but I couldn't get the response&lt;/P&gt;&lt;P&gt;here's my code:&lt;/P&gt;&lt;P&gt;require(["esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/Search",&lt;BR /&gt;"esri/identity/IdentityManager",&lt;BR /&gt;"esri/identity/ServerInfo",&lt;BR /&gt;"esri/request",&lt;BR /&gt;"esri/config"], (Map, MapView, Search, IdentityManager, esriConfig, esriRequest) =&amp;gt; {&lt;/P&gt;&lt;P&gt;if (esriRequest &amp;amp;&amp;amp; esriRequest.interceptors) {&lt;BR /&gt;esriRequest.interceptors.push({&lt;BR /&gt;urls: "&amp;lt;on Premise ArcGIS url&amp;gt;", // Replace with your server URL pattern&lt;BR /&gt;before: function (params) {&lt;BR /&gt;console.log("Interceptor hit", params); // Log to check if the interceptor is working&lt;BR /&gt;params.requestOptions.headers = params.requestOptions.headers || {};&lt;BR /&gt;params.requestOptions.headers.Authorization = `Basic ${token}`;&lt;BR /&gt;},&lt;BR /&gt;error: function (error) {&lt;BR /&gt;console.error("Request error", error); // Log any errors in the request&lt;BR /&gt;return Promise.reject(error);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;} else {&lt;BR /&gt;console.error("esriRequest or esriRequest.interceptors is not defined");&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;And always I get the "esriRequest or esriRequest.interceptors is not defined"&lt;/P&gt;&lt;P&gt;I use version 4.29 , anyone can solve this issue?&lt;/P&gt;</description>
      <pubDate>Sat, 25 May 2024 08:37:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478751#M84721</guid>
      <dc:creator>OssamaHamed</dc:creator>
      <dc:date>2024-05-25T08:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Authenticate ArcGIS on premise</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478765#M84722</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/800138"&gt;@OssamaHamed&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html" target="_self"&gt;esriRequest&lt;/A&gt; doesn't have a `interceptors` property.&amp;nbsp; This property needs to be set on esri config.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#request&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayerUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0";

esriConfig.request.interceptors.push({
  // set the `urls` property to the URL of the FeatureLayer so that this
  // interceptor only applies to requests made to the FeatureLayer URL
  urls: featureLayerUrl,
  // use the BeforeInterceptorCallback to check if the query of the
  // FeatureLayer has a maxAllowableOffset property set.
  // if so, then set the maxAllowableOffset to 0
  before: function(params) {
    if (params.requestOptions.query.maxAllowableOffset) {
      params.requestOptions.query.maxAllowableOffset = 0;
    }
  },
  // use the AfterInterceptorCallback to check if `ssl` is set to 'true'
  // on the response to the request, if it's set to 'false', change
  // the value to 'true' before returning the response
  after: function(response) {
    if (!response.ssl) {
      response.ssl = true;
    }
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 May 2024 10:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478765#M84722</guid>
      <dc:creator>Sage_Wall</dc:creator>
      <dc:date>2024-05-25T10:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Authenticate ArcGIS on premise</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478766#M84723</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/507049"&gt;@Sage_Wall&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Actually I tried your approach with no luck.&lt;/P&gt;&lt;P&gt;The main target of my code to show the basemap in the web app by open a connection between the url of basemap through code.&lt;/P&gt;&lt;P&gt;esriConfig.request.interceptors.push({&lt;BR /&gt;urls: "&amp;lt;&amp;lt;Basemap Url&amp;gt;&amp;gt;",&amp;nbsp;&lt;BR /&gt;before: function (params) {&lt;BR /&gt;console.log("Interceptor hit", params); // Log to check if the interceptor is working&lt;BR /&gt;params.requestOptions.headers = params.requestOptions.headers || {};&lt;BR /&gt;params.requestOptions.headers.Authorization = `Basic ${token}`;&lt;BR /&gt;},&lt;BR /&gt;error: function (error) {&lt;BR /&gt;console.error("Request error", error); // Log any errors in the request&lt;BR /&gt;return Promise.reject(error);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Sat, 25 May 2024 11:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1478766#M84723</guid>
      <dc:creator>OssamaHamed</dc:creator>
      <dc:date>2024-05-25T11:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Authenticate ArcGIS on premise</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1491987#M84860</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Seems like you have esriRequest and esriConfig incorrectly configured, along with missing references. Try this instead:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;require(["esri/Map",&lt;BR /&gt;"esri/views/MapView",&lt;BR /&gt;"esri/widgets/Search",&lt;BR /&gt;"esri/identity/IdentityManager",&lt;BR /&gt;"esri/identity/ServerInfo",&lt;BR /&gt;"esri/request",&lt;BR /&gt;"esri/config"], (&lt;STRONG&gt;EsriMap&lt;/STRONG&gt;, MapView, Search, IdentityManager, &lt;STRONG&gt;ServerInfo,&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;esriRequest, esriConfig&lt;/STRONG&gt;) =&amp;gt; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 18:38:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/authenticate-arcgis-on-premise/m-p/1491987#M84860</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2024-06-13T18:38:18Z</dc:date>
    </item>
  </channel>
</rss>

