<iframe width="100%" height="427" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=place_id:[place_id]&key=[my_key]" allowfullscreen></iframe>
“Google Maps Platform拒绝了您的请求。该IP,站点或移动应用程序无权使用此API key 。收到的请求来自IP地址xxx.xxx.xxx.xxx,引用为https://xxx.xxx/”
在Google Dev中,我启用了Maps Embed API,还启用了Maps Static API。我已将 key 限制为只能与我的域一起使用,其中包括上述代码,例如https://[asterisk].thedomain.com/[asterisk]。
当我不将 key 限制为单个域时,该 map 嵌入将起作用,并且不会引发错误。
问题是, key 在代码中是可读的,因此我需要将 key 限制在我的域内。
有任何想法吗?
谢谢你。
最佳答案
我有问题的网站像https://thedomain.com/一样交付。
Google Maps Platform确实使https://www.thedomain.com/和https://thedomain.com/有所不同。
将我的API限制为https://thedomain.com/*
对我有用,而https://*.thedomain.com/*
并不表示*无效。
关于api - Google Maps : Platform rejected your request.此I [...]网站或无权使用此API key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50537461/