Google Maps API永远无法满足 [英] Google Maps API is never satisfied
问题描述
如果我通过Geocoding API使用URL引荐来源网址身份验证,则会显示:
If I use URL referrer authentication with Geocoding API it says:
There was an error while trying to fix the Venues geolocation information: API keys with referer restrictions cannot be used with this API.
经过研究,我发现这意味着Google Maps正在寻找IP地址身份验证.
Which after research I find that this means that Google Maps is looking for IP address authentication.
但是,如果我将IP地址身份验证与Javascript Maps API结合使用,则会显示:
But if I use IP address authentication with Javascript Maps API it says:
JavaScript API error: RefererNotAllowedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error 您要授权的网站网址: https://example.com
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: https://example.com
怎么回事?
我怎样才能完全满意优质的Google地图?
How can I fully satisfy the good ol'Google Maps?
推荐答案
您似乎正在使用两个不同的Maps API;客户端JavaScript API和服务器端Geocoding API Web服务.这意味着您需要2个API密钥;一个受 HTTP引荐来源网址限制的客户端,另外一个受 IP地址的限制仅限网络服务.
It looks like you're using two different Maps APIs; the client-side JavaScript API and the server-side Geocoding API web service. This means you need 2 API keys; one restricted with HTTP referrers for client-side use, and the other one restricted by IP address for web services only.
要详细了解API密钥限制的工作原理,请查看Google的文档有关API关键的最佳做法.
To learn more on how API key restrictions work check out Google's documentation on API key best practices.
希望这会有所帮助!
这篇关于Google Maps API永远无法满足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!