Edit widget+token

07-24-2012 10:29 AM
New Contributor
I,m using secured map service and flex3. I add token to my config.xml but when I run Edit widget the login page appear and if user dont know the user and pass he should cancel login page 8 times, after that he can edit layer!!!!!!!!!!!
What should I do for solving this problem?
Does Edit widget has token support or no?
Tags (2)
0 Kudos
1 Reply
Occasional Contributor III
Hey Angelina,

This issue is similar to the issue in this thread: http://forums.arcgis.com/threads/61828-Opening-Edit-Widget-causes-secure-service-challenge?p=213638#..., the out-of-the-box Edit Widget is not passing the token when creating feature layers on the fly.

For workaround, you can update the code as follows:

// get corresponding featurelayers
var jsonTask:JSONTask = new JSONTask;
var urlVars:URLVariables = new URLVariables();
urlVars.f = "json";
// Line 401
jsonTask.proxyURL = layer.proxyURL;    
jsonTask.token = layer.token;
jsonTask.url = featureServiceURL;  
jsonTask.execute(urlVars, new AsyncResponder(jsonTask_resultHandler, jsonTask_faultHandler, { layer: layer, count: index }));


fLayerObject = candidateFeatureLayers[index1];
var featureLayer:FeatureLayer = new FeatureLayer;
// Line 461
featureLayer.proxyURL = arcGISDynamicMapServiceLayer.proxyURL;
featureLayer.token = arcGISDynamicMapServiceLayer.token;
featureLayer.url = featureServiceURL + "/" + fLayerObject.id;    
updateFeatureLayerMinMaxScale(featureLayer, fLayerObject.id, copyLayerInfos);
featureLayer.addEventListener(LayerEvent.LOAD, featureLayerLoadHandler);
featureLayer.addEventListener(LayerEvent.LOAD_ERROR, featureLayerLoadErrorHandler);
0 Kudos