Google Maps API Keys

Setup

  • Goto https://console.cloud.google.com and login with your Google Account or create an account.

  • Create a Project on Google Cloud Console.

  • Enable the following APIs on your project:

  1. Geoencoding API

  2. Maps Javascript API

  3. Places API

  4. Maps Elevation API

  5. Maps Static API

  6. GeoLocation API

  7. Distance Matrix API

  8. Maps SDK for Android

  9. Maps SDK for iOS

  • You will have to set up the Google Billing account as well.

  • From the Left menu, goto API & Services > Credentials and click on `Create Credentials`

  • Create a Key named HTTP Key and under the website restrictions tab add your website URL like the following

If your website is my-domain.com add these: https://my-domain.com/*and https://www.my-domain.com/*

Make sure you addasterisk (*) at the end of the URL.

  • Create another key named IP Key and under the IP Addresses section paste your website/server IP address.

Very Important

Sometimes on a shared hosting environment, your website IP might not be enough to configure the IP restricted key. In these cases, you will be shown a popup message like:

Geocoding failed because `This IP, site or mobile application is not authorized to use this API Key. Request received from IP address *.*.*.* with empty referer.

The *.*.*.* is your server's IP address which needs to be set on the IP Restricted key. Go back to the Google Cloud Console and set this IP Address provided on the popup.

  • Save all the changes and make changes in all modules where GOOGLE_MAPS_KEY or googleMapsAPIkey is used

Google API's takes 5-10 minutes to reflect the changes on your website.

Video Walkthrough

Last updated