<?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: setRequestPreCallback is partially working in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setrequestprecallback-is-partially-working/m-p/632258#M59021</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have the snippet of code you are using in setRequestPreCallback ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it needs to be set as a query param to the service so the request should look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303942; font-family: Menlo, monospace; font-size: 11px;"&gt;MapServer?f=json&amp;amp;token={insert token here}&amp;amp;dpi=96&amp;amp;transparent=true&amp;amp;format=png8&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Aug 2015 18:25:36 GMT</pubDate>
    <dc:creator>RobertWinterbottom</dc:creator>
    <dc:date>2015-08-28T18:25:36Z</dc:date>
    <item>
      <title>setRequestPreCallback is partially working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setrequestprecallback-is-partially-working/m-p/632257#M59020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an api sitting in front of AGS that requires it's own authentication. I am using &lt;STRONG&gt;setRequestPreCallback&lt;/STRONG&gt; as stated by the &lt;A href="https://developers.arcgis.com/javascript/jsapi/esri.request-amd.html#esrirequest.setrequestprecallback"&gt;ESRI docs&lt;/A&gt;​.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the image below, you can see that the first 2 requests are returning 200. The first request is &lt;A href="http://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0"&gt;CORS Preflight&lt;/A&gt; and the second request is the JS api getting the json info from the MapServer.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="123916" alt="setRequestCallback.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/123916_setRequestCallback.png" style="width: 620px; height: 156px;" /&gt;&lt;/P&gt;&lt;P&gt;The second request uses the function I have set in &lt;STRONG&gt;setRequestPreCallback(...) &lt;/STRONG&gt;to properly set a header value with the token. However, whenever an image is requested from the MapServer (via export), the function I have in setRequestPreCallback is not called and the token is not set, leaving me with a bunch of 401 Unauthorized requests.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Feel free to answer on SO as well: &lt;A href="http://stackoverflow.com/questions/32238110/setrequestprecallback-is-partially-working" title="http://stackoverflow.com/questions/32238110/setrequestprecallback-is-partially-working"&gt;http://stackoverflow.com/questions/32238110/setrequestprecallback-is-partially-working&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Brad Janke&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 22:55:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setrequestprecallback-is-partially-working/m-p/632257#M59020</guid>
      <dc:creator>BradJanke</dc:creator>
      <dc:date>2015-08-26T22:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: setRequestPreCallback is partially working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setrequestprecallback-is-partially-working/m-p/632258#M59021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have the snippet of code you are using in setRequestPreCallback ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it needs to be set as a query param to the service so the request should look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #303942; font-family: Menlo, monospace; font-size: 11px;"&gt;MapServer?f=json&amp;amp;token={insert token here}&amp;amp;dpi=96&amp;amp;transparent=true&amp;amp;format=png8&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2015 18:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setrequestprecallback-is-partially-working/m-p/632258#M59021</guid>
      <dc:creator>RobertWinterbottom</dc:creator>
      <dc:date>2015-08-28T18:25:36Z</dc:date>
    </item>
  </channel>
</rss>

