Google translate API v2 - (403) Access not configured

I have a problem with the google console API when using google translate through it. When I run the test from my local machine, it works fine, but when I try to run it on my remote test virtual server, it returns this 403 above.

I use Simple API access using the Server key in access to the API console, and my key is configured for both local and IP addresses of the test computer.

debugging:

lynx --dump "checkip.dyndns.org"; 

- IP mapping with a parameter in the API key setting in the Google API console

 curl -v "https://www.googleapis.com/language/translate/v2?q=hello&target=de&source=en&key=MYAPIKEY" { "error": { "errors": [ { "domain": "usageLimits", "reason": "accessNotConfigured", "message": "Access Not Configured" } ], "code": 403, "message": "Access Not Configured" } } 

As I said, the same thing works on my local machine. An API key is configured for both IP addresses in the Google API console.

UPDATE: when I used the β€œBrowser Key” attached to the referral URL instead of IP, it works. Therefore, the problem should be somehow in IP, but I can not get there. Any whatsmyip service confirms my IP addresses.

+6
source share
2 answers

I had the same problem, but with api tasks, it turned out that I did not enable the "api task" on the services tab in https://code.google.com/apis/console . You may have the same problem, but with the 'translate api' it doesn't turn on

+6
source

I tried to find a solution, but it seems to be a Google API error. Only the relevant support service that I found was in Google Groups, where there are more people with the same problems, but I did not find any solution or effort to check this from Google.

So, here is a workaround - a browser key that is not tied to IP, but an HTTP referrer.

Check this out if you use the Google APIs API Client Library for PHP .

Please note that this is a temporary hack, not a permission. Browser keys are not tied to an IP address, so anyone can access your API access if they know your token. The connection is still through https.

+3
source

Source: https://habr.com/ru/post/922413/


All Articles