Esri / esri-leaflet-geocoder

helpers for using the ArcGIS World Geocoding Service in Leaflet
http://esri.github.io/esri-leaflet/examples/geocoding-control.html
Apache License 2.0
244 stars 101 forks source link

L.esri.Geocoding.geocode not accepting API key #277

Closed Jelfff closed 3 years ago

Jelfff commented 3 years ago

This page http://esri.github.io/esri-leaflet/api-reference/tasks/geocode.html shows the following example under "Base classes”:

L.esri.Geocoding.geocode({apikey: 'YOUR API KEY'}).text('380 New York St, Redlands, California, 92373').run(function (err, results, response) { if (err) { console.log(err); return; } console.log(results); });

When I use the above code with my ESRI developer API key and my search string, I get back the following error:

"code": 499, "message": "Token Required", "details": []

I would like to get this working since I am using my own search interface instead of ESRI's search control.

Additional context

Add any other context about the problem here. If you're are not using the CDN, please note what loading/bundling library you are using

I am using: <script src="https://unpkg.com/esri-leaflet@**3.0.2/dist/esri-leaflet.js**" integrity="sha512-myckXhaJsP7Q7MZva03Tfme/MSF5a6HC2xryjAM4FxPLHGqlh5VALCbywHnzs2uPoF/4G/QVXyYDDSkp5nPfig==" crossorigin="">

and <script src="https://unpkg.com/esri-leaflet-geocoder@**3.1.0/dist/esri-leaflet-geocoder.js**" integrity="sha512-FbJc8QgjTS3k1G41cT+bSnU7D41T2sUdLBN1ElrYDN3E5vZwMuoft3PqXAJN9FCa2lXT7Anva7X0OuwiLDJ+yg==" crossorigin="">

gavinr commented 3 years ago

Thank you for the report. I have tested this and can replicate your issue - I agree there seems to be an issue here. Working on a fix here: #278

gavinr commented 3 years ago

This is fixed in v3.1.1. Thanks!

Jelfff commented 3 years ago

Fantastic! Many thanks for the super fast fix. 3.1.1 works perfect.

GuidoTapia commented 2 years ago

it seems that this same problem is happening with reverseGeocoder, I'm getting this response {code: 499, message: 'Token Required', details: Array(0)} I had no problems with Geocoder