{"code":498,"message":"Invalid token","details":[]}
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);
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.
Mo, have you done a test with api 2.8 ?
dojo.require("esri.IdentityManager"); var facils = new esri.layers.FeatureLayer("https://mydomain.com/ArcGIS/rest/services/secured/0",{ mode:esri.layers.FeatureLayer.MODE_ONDEMAND, outFields:["*"] });
2.8 identity manager works great for secure services, even if the service is used for find/query.
someone correct me if I'm wrong, but the only change to your code is to add:dojo.require("esri.IdentityManager"); var facils = new esri.layers.FeatureLayer("https://mydomain.com/ArcGIS/rest/services/secured/0",{ mode:esri.layers.FeatureLayer.MODE_ONDEMAND, outFields:["*"] });