Reputation: 89
google.maps.Geocoder().geocode always return REQUEST_DENIED with all the APIs enabled in a commercial google map account
We tried to use a key of a paid commercial account with all the APIs (15 of them) enabled but still got REQUEST_DENIED when calling google.maps.Geocoder().geocode
new google.maps.Geocoder().geocode( { 'address': site.address}, function(results, status) {
//console.log('address:'+ site.address)
if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
site.latitude = latitude
site.longitude = longitude
if (callback) {
callback(site)
}
} else {
if (errorHandler) {
errorHandler.call(self, "Invalide address")
}
}
});
Upvotes: 2
Views: 5731
Reputation: 1
After setting API restrict, it still returns REQUEST_DENIED
.
Then, I restart the bill account, and it works.
Upvotes: 0
Reputation: 5699
The REQUEST_DENIED error status code usually means there is an issue with your project setup or api key. Besides enabling billing, to use Google's Geocoder:
Hope this helps you and anyone else who encounters this error.
Upvotes: 3