Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps JS API on localhost: RefererNotAllowedMapError

For duplicate-tempted visitors: I'm aware of all similar issues but mine is not solved by them

I'm developing locally a react app and my code looks like:

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

and my console looks like: google console

But I still get:

Google Maps JavaScript API error: RefererNotAllowedMapError https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error Your site URL to be authorized: http://localhost:3000/

And I have waited for 2+ hours

like image 450
ted Avatar asked Mar 26 '19 01:03

ted


People also ask

Can we use Google Map API in localhost?

in the form after "My web site URL:". The API key they give you works for your localhost.


1 Answers

I struggled with the same problem but this seemed to work for me:

http://localhost/

Just make sure you click "Save" below

like image 189
Sanduo Avatar answered Oct 17 '22 16:10

Sanduo