Google static Maps always returning 403 when a key

2019-02-19 02:32发布

问题:

I always get a 403 Forbidden response if I provide an API key within the map request; without specifying it everything goes well and I can get to the map. The problem is that I have to work with an API key in order to monitor usage and per-user quota.

Here's an example: http://jsfiddle.net/demerzel3/ZUC6m/

http://maps.googleapis.com/maps/api/staticmap?key=AIzaSyDqq140S23Q_H_dmyUIFz-YwsbH_rCSFSs&size=320x140&scale=2&zoom=15&sensor=false&markers=color:0xEE6B1C|label:A|V.%20FALCONE%207%20CASALETTO%20LODIGIANO%20(LO)

In the example above I'm using a registered API Key configured in order to allow jsfiddle as a referer (I can attach a screenshot of the API Console if necessary). What am I doing wrong?

Thanks

回答1:

I finally sorted things out, the problem was that I was subscribing to the "Google Maps API v2" service instead of "Static Maps API".

Switching them in the API console fixed the problem.