We are currently in the process of trying to secure our services in our organization and I am not understanding an error with a secure service I'm working with. Going thru ArcGIS Server Manager I set the security settings for private and specify roles for the individual service. This of course removes the service from our REST services directory until I log in with my credentials, then I am able to see it. Using the secured service I am able to create a web map in AGOL which of course prompts me for my credentials at which time when entered displays the sercured service on the web map.My problem or question is that when I use the service in a javascript application it prompts me for authorization but when I enter my credentials it does not allow me access to the secured service through the javascript application. I get an "Unable to access the authentication service". What am I missing? Why can't I access the service through the application?Here is my code:<script>
dojo.require("esri.map");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("esri.tasks.find");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.form.Button");
dojo.require("esri.dijit.Legend");
dojo.require("esri.InfoTemplate");
var map, center, zoom, grid;
function init() {
center = [-98.495, 29.42];
zoom = 13;
map = new esri.Map("map", {
basemap: "streets",
center: center,
zoom: zoom
});
var transMapLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", {
id: "trans",
minScale: "4500",
opacity: "0.6"
});
var mainMapLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://mapservices2.bexar.org/arcgis/rest/services/GecoVector/ACA_locations_test/MapServer");
map.addLayers([transMapLayer, mainMapLayer]);
var legend = new esri.dijit.Legend({
map: map,
layerInfos: [{layer:mainMapLayer,title:"ACA Enrollment Assistance"}],
arrangement: esri.dijit.Legend.ALIGN_RIGHT
},"legendDiv");
legend.startup();
map.on("click", identifyPOI);
dojo.connect(grid, "onRowClick", onRowClickHandler);
};
function identifyPOI(evt){
var identify = new esri.tasks.IdentifyTask("http://mapservices2.bexar.org/arcgis/rest/services/GecoVector/ACA_locations_test/MapServer");
var identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.returnGeometry = true;
identifyParams.tolerance = 3;
map.infoWindow.clearFeatures();
identify.execute(identifyParams, function(results){
map.infoWindow.setFeatures(dojo.map(results, function(result){
var feature = result.feature;
feature.setInfoTemplate(new esri.InfoTemplate( "Name", "<tr>Name:<td>${Name}</tr></td><br><tr>Address:<td>${Address}</tr></td><br><tr>Zip:<td>${ZIP}</tr></td>"));
return feature;
}));
map.infoWindow.show(evt.mapPoint);
});
};
function doFind() {
var findTask = new esri.tasks.FindTask("http://mapservices2.bexar.org/arcgis/rest/services/GecoVector/ACA_locations_test/MapServer");
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = [ "Name", "Address", "ZIP"];
findParams.outSpatialReference = map.spatialReference;
findParams.searchText = dojo.byId("ownerName").value;
findTask.execute(findParams,showResults);
};
function showResults(results) {
map.graphics.clear();
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 25, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([0, 255, 0, 0.25]));
var items = dojo.map(results,function(result){
var graphic = result.feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
return result.feature.attributes;
});
//Create data object to be used in store
var data = {
identifier: "OBJECTID", //This field needs to have unique values
label: "OBJECTID", //Name field for display. Not pertinent to a grid but may be used elsewhere.
items: items
};
//Create data store and bind to grid.
var store = new dojo.data.ItemFileReadStore({ data:data });
grid = dijit.byId('grid');
grid.setStore(store);
//Zoom back to the initial map extent
map.centerAndZoom(center, zoom);
}
//Zoom to the parcel when the user clicks a row
function onRowClickHandler(evt){
var clickedTaxLotId = grid.getItem(evt.rowIndex).OBJECTID;
var selectedTaxLot;
var distance = 100;
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.OBJECTID === clickedTaxLotId){
selectedTaxLot = graphic.geometry;
return;
}
});
var newExtent = new esri.geometry.Extent({
"xmin": selectedTaxLot.x - distance,
"ymin": selectedTaxLot.y - distance,
"xmax": selectedTaxLot.x + distance,
"ymax": selectedTaxLot.y + distance,
"spatialReference": {
"wkid": 102100
}
});
map.setExtent(newExtent);
};
dojo.ready(init);
</script>
Here is the error:[ATTACH=CONFIG]29368[/ATTACH]Any help or direction would be greatly appreciated!