Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Googlemaps API Key for Localhost

How do I get Google Maps API key to work on localhost?

I've created an API key and under referrers I add the following:

Accept requests from these HTTP referrers (websites) (Optional)  Use asterisks for wildcards. If you leave this blank, requests will be  accepted from any referrer. Be sure to add referrers before using this key  in production.   localhost 

This doesn't work and if I exclude the API key it doesn't work, either.

like image 281
adam78 Avatar asked Sep 05 '16 11:09

adam78


People also ask

Can I use Google Maps API on localhost?

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

How do I find my Geocoding API key?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.


1 Answers

  1. Go to this address: https://console.developers.google.com/apis
  2. Create new project and Create Credentials (API key)
  3. Click on "Library"
  4. Click on any API that you want
  5. Click on "Enable"
  6. Click on "Credentials" > "Edit Key"
  7. Under "Application restrictions", select "HTTP referrers (web sites)"
  8. Under "Website restrictions", Click on "ADD AN ITEM"
  9. Type your website address (or "localhost", "127.0.0.1", "localhost:port" etc for local tests) in the text field and press ENTER to add it to the list
  10. SAVE and Use your key in your project
like image 172
Sajad Mirzaei Avatar answered Sep 20 '22 08:09

Sajad Mirzaei