ExtractData is KILLING ME!

04-23-2020 09:12 AM
New Contributor II

I'm about to change careers over this! I simply want to allow the user of a Web Application using the Javascript API (3.x) to download a shape file of the current extent. Simple, right? No!

Here's what I've done so far: I am using the following js code (which I got from a few posts on here):

var extractUrl = "http://mydomain/arcgis/rest/services/System/SpatialAnalysisTools/GPServer/ExtractData"

var layers = [app.mapView.map.getLayer(app.mapView.map.layerIds[1])];

var extractData = new ExtractData({
featureLayers: layers,
map: app.mapView.map,
analysisGpServer: extractUrl
}, "analysis-tool");

extractData.on("job-result", function (result) {
var resultLayer = new FeatureLayer(result.value.url || result.value, {
outFields: ['*'],
infoTemplate: new InfoTemplate()

On my ArcGIS Server Manager, I have opened up the SpatialAnalysisTools service for anonymous access. When I run the code, I get a login prompt. (when I put the url, with or without the proxy, in a browser there is no login and it works fine)

When I attempt to login, I get 

I think the reason I'm getting the Unable to access is because it is building the tokens URL with https and my dev server isn't set up for https. I don't know how to get past that. But the main issue is that I don't want a login at all. 


What's with the middle call? I'm wondering if that's what is causing the login. 

I just have no ideas at this point. I just need some guidance. 

Thanks in advance!

0 Kudos
2 Replies
Esri Regular Contributor

I think that middle call is just getting general information about ArcGIS Server (e.g. version, etc.). That's strange that if the service is public and not secure, it should not try to authenticate. Does the ArcGIS Server allow http and https connections?

To check:

Sign in to your ArcGIS Server Administrator Directory at https://gisserver.domain.com:6443/arcgis/admin.
Browse to security > config > update.
Check if the Protocol parameter is  set to HTTP Only, HTTPS Only, or to allow both HTTP and HTTPS.

Not that I would recommend only using HTTP, but it might be a good test.

You should be using HTTPS anyway, but I understand that if this is a development environment, you don't want to go through the hassle.

0 Kudos
New Contributor II

I just checked: we do have it set to HTTP and HTTPS. But yeah, we do use https in test and prod environments. Just using http in DEV because, like you mentioned, it's a pain not to.

What I'm finding so annoying is that I don't know where the code is that's throwing up the login prompt. And both of the first 2 calls in the screen capture above return a 200. In the response from the ExtractData, it includes a helpurl, and that one resolves fine with no authentication.

I even went on the server and set anonymous access to the System Folder to go along with the access I already set on the SpatialAnalysisTools service and no luck.

We have other products on this server, so I'll get the GIS admin to set the protocol to HTTP only and see if that makes nay difference. I'm willing to bet that may fix the issue of the login not working, but I'm trying to avoid the login completely.

Thanks for your input!