Skip to content

Google Map

Enable Google Map Api Key

Step 1 — Open Google Cloud Console

  1. Open your browser and go to https://console.cloud.google.com.
  2. Sign in with your Google account.
  3. Accept terms if prompted and set up billing (only for new users).
  4. Once logged in, you’ll see the Google Cloud Console dashboard where you can manage projects and services.

Step 2 — Create (or Select) a Project

  1. In the Google Cloud Console dashboard, click the project dropdown at the top of the page.
  2. To use an existing project, simply select it from the list.
  3. To create a new project, click New Project, enter a Project Name, choose a Billing Account (if required), and click Create.
  4. Wait a few seconds — your project will be ready, and you’ll be switched to it automatically.

Step 3 — Enable Required APIs

  1. In the Google Cloud Console, open the Navigation menu (☰) and select APIs & Services → Library.
  2. Search for the API you need (e.g., Maps JavaScript API, Geocoding API, etc.).
  3. Click on the API result, then click Enable.
  4. Repeat the process for each required API.

After enabling, complete these 2 steps:

  1. Click Agree and Continue.
  2. If you agree, fill out the form and click Start Free. If you do not agree, remove the red-marked URL and refresh the page.

Step 4 — Create Credentials (API Key)

  1. In the Google Cloud Console, go to APIs & Services → Credentials.
  2. Click + Create Credentials and select API key.
  3. A new API key will be generated and shown in a popup.
  4. Copy the key and keep it secure — you’ll use it to access Google APIs.
  5. (Optional) Click Restrict Key to limit usage by IP, HTTP referrer, or API for better security.

Step 5 — Restrict Your API Key (Important)

Edit the key → Application restrictions and API restrictions.

  1. In the Credentials page, find your API key and click Edit.
  2. Under Key restrictions, choose a restriction type:
    • HTTP referrers (websites): Allow only your domains.
    • IP addresses: Allow only trusted server IPs.
    • Android/iOS apps: Restrict by app package or bundle ID.
  3. Under API restrictions, select Restrict key, then choose only the APIs you enabled (e.g., Maps, Geocoding).
  4. Click Save to apply restrictions.

Step 6 — Use the Key in Your App

  1. Copy your restricted API key from the Google Cloud Console.
  2. Add it to your application’s configuration, code, or environment file depending on the platform:
    • Web app: Include it in the script tag when loading Google Maps or APIs.
    • Server app: Store it in environment variables (.env) for security.
    • Mobile app: Add it in the app configuration (Android/iOS).
  3. Deploy or run your app, and the API key will authenticate your requests.

www.onezeroart.com