Query Layer from ArcGIS Online

734
3
Jump to solution
11-21-2018 01:41 AM
PraveenTirumandyam
New Contributor

Hello,

I am new to ArcGIS JS API. I am trying to build logic to query a layer created by me. The intent is to build an analytic front-end. But, I am not able to access the layer without using the temporary token created for an app during development.

Right now, I do not have any other interest other than querying layer without manual login. How to access the layer? I am not able to figure it out as all samples do not have any authentication in front of them.

I have created a proxy service by creating an app but, the urls of layer server and proxy are different. I am not able to figure out how to configure esri.Config such that layer is fetched through proxy.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Correct you must host the proxy on your own web server.

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Praveen,

   Getting the access to the layer to go through the proxy is a matter of proper proxy deployment and configuration and the proper setting of the esri.config.defaults.io.proxyRules and proxyUrl. The esri.config.defaults.io.proxyRules is an array of objects that have urlPrefix and proxyUrl properties. The urlPrefix would be the simple url to your secured map service.

The proxy.config must also contain the serverUrl that has the url for that same map service and mentioned earlier.

https://community.esri.com/groups/technical-support/blog/2015/04/07/setting-up-a-proxy 

0 Kudos
PraveenTirumandyam
New Contributor

Hello Robert,

Thanks for the pointer. Just to confirm ArcGIS Online does not provide a proxy service and I have to set this up at another location.

Is my understanding correct?

Regards,

Praveen

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Correct you must host the proxy on your own web server.