Geosearch private feature layer

560
2
05-22-2017 08:55 AM
AlexandraYanick
New Contributor

I am trying to use the searching feature layers  option for geocoder (Searching feature layers | Esri Leaflet ), but my feature layer is private.  Looking at the documentation, I thought if I used the token property for the arcgisonline provider that that would work, but it doesn't seem to be working.  Does anyone know if I am doing something wrong?  I'm including my code sample.

0 Kudos
2 Replies
JohnGravois
Frequent Contributor

i took a quick look at this and it looks like we're currently ignoring tokens passed to arcgisOnlineProvider entirely.

the way i envision this working is that 'token' should be a universally understood provider constructor option and that it should be up to the developer to pass an appropriate token to any provider that requires one.

https://github.com/Esri/esri-leaflet-geocoder/issues/177 

JohnGravois
Frequent Contributor

i don't know exactly what i screwed up, but i was wrong earlier today.  tokens are definitely already passed through when they are specified as an option for any of the various providers.

if you update the static token in the jsbin below and perform a search for a US state, the network traffic confirms that the token is passed along in the corresponding requests.

http://jsbin.com/fafexuf/edit?html,output 

i'll make a point of updating the documentation.