本地主机上的 Google Maps JS API:RefererNotAllowedMapError

ted*_*ted 6 google-maps reactjs

对于重复诱惑的访问者:我知道所有类似的问题,但他们没有解决我的问题

我正在本地开发一个 React 应用程序,我的代码如下所示:

<Script
    url={`https://maps.googleapis.com/maps/api/js?key=${process.env.REACT_APP_GOOGLE_PLACES_API_KEY || ""}&libraries=places` }
    onLoad={ this.handleScriptLoad }
/>
Run Code Online (Sandbox Code Playgroud)

我的控制台看起来像: 谷歌控制台

但我仍然得到:

Google Maps JavaScript API 错误:RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error 您要授权的站点 URL:http://localhost:3000 /

我已经等了 2 个多小时

小智 -6

不是本地主机

需要你的ip

例如) 123.12.1.123:3000