Google地图:平台拒绝了您的请求.此I [...]网站或[...]无权使用此API密钥

Tho*_*mka 7 embed api maps

<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>
Run Code Online (Sandbox Code Playgroud)

"Google Maps Platform拒绝了您的请求.此IP,网站或移动应用程序无权使用此API密钥.请求从IP地址xxx.xxx.xxx.xxx收到,请参阅:https://xxx.xxx/ "

在Google Dev中,我启用了Maps Embed API和Maps Static API.我限制了仅使用我的域的密钥,其中包含上述代码,例如https:// [asterisk] .thedomain.com/[asterisk].

当我不限制此单个域的密钥时,地图嵌入工作并且不会抛出错误.

问题是,密钥在代码中是可读的,因此我需要将密钥限制在我的域中.

有任何想法吗?

谢谢.

Tho*_*mka 3

我的相关网站的交付方式类似于https://thedomain.com/

Google Maps Platform 确实在https://www.thedomain.com/https://thedomain.com/之间有所区别。

限制我的 APIhttps://thedomain.com/*对我有用,但https://*.thedomain.com/*并不意味着 * 没有任何作用。