<?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 arcgis 3.14 add authorization header and preserve query parameters via setRequestPreCallback in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-3-14-add-authorization-header-and-preserve/m-p/1646636#M87565</link>
    <description>&lt;P&gt;Greetings!!&lt;BR /&gt;&lt;BR /&gt;I have been tasked with adding an Authorization header to our layer query request.&lt;/P&gt;&lt;P&gt;Referencing&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-headers-for-esrirequest-using/m-p/608187/highlight/true#M56878" target="_blank"&gt;Solved: Re: How to set headers for esriRequest using .setR... - Esri Community&lt;/A&gt;&amp;nbsp;I managed to get the setRequestPreCallback set and the Authorization header added.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, when the callback function is fired, it only has 4 of the 9 needed query parameters for the link to work.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a method of recovering the missing query parameters??&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We are using arcgis 3.14.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;-Daniel&lt;/P&gt;</description>
    <pubDate>Thu, 28 Aug 2025 20:26:49 GMT</pubDate>
    <dc:creator>DanielJennings</dc:creator>
    <dc:date>2025-08-28T20:26:49Z</dc:date>
    <item>
      <title>arcgis 3.14 add authorization header and preserve query parameters via setRequestPreCallback</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-3-14-add-authorization-header-and-preserve/m-p/1646636#M87565</link>
      <description>&lt;P&gt;Greetings!!&lt;BR /&gt;&lt;BR /&gt;I have been tasked with adding an Authorization header to our layer query request.&lt;/P&gt;&lt;P&gt;Referencing&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-headers-for-esrirequest-using/m-p/608187/highlight/true#M56878" target="_blank"&gt;Solved: Re: How to set headers for esriRequest using .setR... - Esri Community&lt;/A&gt;&amp;nbsp;I managed to get the setRequestPreCallback set and the Authorization header added.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;However, when the callback function is fired, it only has 4 of the 9 needed query parameters for the link to work.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Is there a method of recovering the missing query parameters??&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;We are using arcgis 3.14.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;-Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 20:26:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-3-14-add-authorization-header-and-preserve/m-p/1646636#M87565</guid>
      <dc:creator>DanielJennings</dc:creator>
      <dc:date>2025-08-28T20:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis 3.14 add authorization header and preserve query parameters via setRequestPreCallback</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-3-14-add-authorization-header-and-preserve/m-p/1646788#M87567</link>
      <description>&lt;P&gt;In&amp;nbsp;3.14 you can’t. esri.config.defaults.io.setRequestPreCallback fires before ArcGIS JS finalizes the request, so you’ll only see a partial content object; the library appends the rest (e.g., f, where/outFields, token, cache-buster, JSONP bits) after your callback. There’s no API to “recover” those missing params in that hook.&lt;/P&gt;&lt;P&gt;Practical options:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Use a proxy to add the Authorization header server-side. This is the most reliable with 3.x (no CORS/header headaches, no param timing issues).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Bypass QueryTask/FeatureLayer and call the endpoint yourself with esri.request, where &lt;EM&gt;you&lt;/EM&gt; supply the full payload and header:&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="javascript"&gt;require(["esri/request"], function(esriRequest){
  esriRequest({
    url: layerUrl + "/query",
    content: {
      where: "GlobalID='" + guid + "'",
      outFields: "*",
      returnGeometry: false,
      f: "json"
    },
    headers: { "Authorization": "Bearer " + token }
  }, { usePost: true }).then(handle, err);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Upgrade (if you can) to a later 3.x or 4.x, where header handling and CORS behavior are cleaner. Still, for 3.x the proxy remains the simplest fix.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Keep using the pre-callback only to inject the header; don’t rely on it to inspect the final query. If you need to see/shape every param, build the request yourself or proxy it.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 13:08:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-3-14-add-authorization-header-and-preserve/m-p/1646788#M87567</guid>
      <dc:creator>VenkataKondepati</dc:creator>
      <dc:date>2025-08-29T13:08:10Z</dc:date>
    </item>
  </channel>
</rss>

