elivz / VzAddress-Craft

Address fieldtype for the Craft CMS
30 stars 13 forks source link

Google Maps API key bug #16

Closed erikreagan closed 7 years ago

erikreagan commented 7 years ago

While trying to use the {{ vzAddress.staticMap(params) }} I'm getting an error from Google due to API restrictions. It appears a key is required by Google Maps to work. So I registered an API key and continued to receive errors, just a new one. This was the error after using a legitimate API key:

The Google Maps API server rejected your request. The provided API key is invalid.

So I looked at the request url and noticed that the API key in the URL was a lowercase version of the actual key. Ergo the error.

Line 116 of VzAddress_AddressModel.php converts characters to lowercase. Is this for some old Google API implementation?

I removed the strtolower function for now and it's working for me. Would you like me to submit a pull request to patch it up? It seems to solve the problem.

elivz commented 7 years ago

I just published v1.0.6 without the strtolower on that parameter. No idea why that was there, probably just stupid copy-and-pasting from the rest of the parameters, which we do want lowercase. Thanks for catching that!

erikreagan commented 7 years ago

Awesome. Thanks for the quick attention to it!