Browser API key does not work with referer
Asked Answered
S

2

10

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?

Sumptuous answered 16/9, 2015 at 10:52 Comment(0)
C
13

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.

Crux answered 3/2, 2016 at 19:19 Comment(0)
E
9

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://static.mcmap.net/file/mcmap/ZG-AbGLDKwfpKnMxcF_AZVLQamyA/CzhUn.png

Endowment answered 1/3, 2017 at 7:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.