Browser API key does not work with referer

Szmulik picture Szmulik · Sep 16, 2015 · Viewed 14.9k times · Source

I'm making website which use Google translate API. I have setup Browser API key But the problem is that Browser API key works only if I leave empty field Accept requests from these HTTP referrers (web sites) .

If I put there *.mydomain.com/* I’m getting error:

There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.

What am I doing wrong?

Answer

Dimas Pante picture Dimas Pante · Feb 3, 2016

Just to keep note, I had this error today, and it happens because of the Key Type. You need to use a Server Key instead of a Browser Key.

To create one, go to Google Console (https://console.developers.google.com/), and API Manager > Credentials.