10
votes

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?

2

2 Answers

13
votes

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.

9
votes

Go to https://console.developers.google.com, in credential tab, edit api key you are using and change api restriction from "browser" to "none" or "server". note: if your are using server restriction that you need to add correct server path.

https://i.stack.imgur.com/CzhUn.png