Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The following are the steps to restrict Google API key using HTTP referrers:

  1. Go to the Google Cloud Console and select your project.

  2. Click on the hamburger menu icon, then go to the API & Services section and select Credentials.

  3. Locate the API key that you want to restrict and click on the Edit button beside it.

  4. Scroll down until you see the Key restriction section and select HTTP referrers.

  5. Under the Accept requests from these HTTP referrers section, add the domain names that you want to allow access to the API key. You can add multiple domains by separating them with commas.

  6. Under the Application restrictions section, select the HTTP referrers option.

  7. Save the changes by clicking on the Save button.

Once you have completed these steps, only the domains that you have specified will be able to access your Google API key. Any requests made from domains not on the list will be denied.