<?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: Invalid Token for QueryTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595259#M55757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;But like I mentioned, typing the url+token in the browser authenticates with no issues. If the token was expired I wouldn't be able to open up the url in the browser. Btw I'm using the JavaScript API v1.2 if that makes a difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2012 15:07:09 GMT</pubDate>
    <dc:creator>MostafaAsadi</dc:creator>
    <dc:date>2012-02-09T15:07:09Z</dc:date>
    <item>
      <title>Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595257#M55755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a secure Map Server that I can access by typing its url and token in the address bar of my browser: &lt;/SPAN&gt;&lt;A href="http://serverurl?token=token_value" rel="nofollow noopener noreferrer" target="_blank"&gt;http://serverurl?token=token_value&lt;/A&gt;&lt;SPAN&gt;. However, when I call a QueryTask, I get an "Invalid Token" error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;{"code":498,"message":"Invalid token","details":[]}&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's how I construct and run the QueryTask:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var url = "http://serverurl?token=token_value";
var task = new esri.tasks.QueryTask(url);
var q = new esri.tasks.Query();

// set query parameters ....

task.execute(q, callbackHandler);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can someone point out to me the possible cause for this error?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595257#M55755</guid>
      <dc:creator>MostafaAsadi</dc:creator>
      <dc:date>2021-12-12T01:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595258#M55756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the token can be also expired with error 498.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 07:22:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595258#M55756</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2012-02-09T07:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595259#M55757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;But like I mentioned, typing the url+token in the browser authenticates with no issues. If the token was expired I wouldn't be able to open up the url in the browser. Btw I'm using the JavaScript API v1.2 if that makes a difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 15:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595259#M55757</guid>
      <dc:creator>MostafaAsadi</dc:creator>
      <dc:date>2012-02-09T15:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595260#M55758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Did you fix it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Apr 2012 23:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595260#M55758</guid>
      <dc:creator>GeorgePan</dc:creator>
      <dc:date>2012-04-01T23:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595261#M55759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;But like I mentioned, typing the url+token in the browser authenticates with no issues. If the token was expired I wouldn't be able to open up the url in the browser. Btw I'm using the JavaScript API v1.2 if that makes a difference.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We've greatly simplified how secure services are accessed by introducing the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/identitymanager.htm"&gt;identity manager&lt;/A&gt;&lt;SPAN&gt; at version 2.5. My recommendation is to upgrade your app to at least 2.5 (preferably you would upgrade to the latest version, which is 2.8) and use the identity manager to handle tokens for you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2012 14:48:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595261#M55759</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-02T14:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595262#M55760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Mo, have you done a test with api 2.8 ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 06:13:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595262#M55760</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2012-04-03T06:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595263#M55761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Mo, have you done a test with api 2.8 ?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.8 identity manager works great for secure services, even if the service is used for find/query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;someone correct me if I'm wrong, but the only change to your code is to add:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.require("esri.IdentityManager");
var facils = new esri.layers.FeatureLayer("https://mydomain.com/ArcGIS/rest/services/secured/0",{
&amp;nbsp;&amp;nbsp;&amp;nbsp; mode:esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields:["*"]
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:33:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595263#M55761</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2021-12-12T01:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595264#M55762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;2.8 identity manager works great for secure services, even if the service is used for find/query.&lt;BR /&gt;&lt;BR /&gt;someone correct me if I'm wrong, but the only change to your code is to add:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.require("esri.IdentityManager");
var facils = new esri.layers.FeatureLayer("https://mydomain.com/ArcGIS/rest/services/secured/0",{
&amp;nbsp;&amp;nbsp;&amp;nbsp; mode:esri.layers.FeatureLayer.MODE_ONDEMAND,
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields:["*"]
});
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's great! And yes, that's all you need to do in your code to use the identity manager. What's stopping you from upgrading to 2.8?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:33:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595264#M55762</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-12T01:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Token for QueryTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595265#M55763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We have used the Sample JavaScript Viewer as template for our work and now upgrading to v2.8 is going to be painful, especially that I have no idea what needs to change.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 23:16:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/invalid-token-for-querytask/m-p/595265#M55763</guid>
      <dc:creator>MostafaAsadi</dc:creator>
      <dc:date>2012-04-04T23:16:29Z</dc:date>
    </item>
  </channel>
</rss>

