Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Cloud Translate API - Your client does not have permission to get URL /language/translate/v2

I'm trying to make a request to google cloud translate:

 

$res = $this->request(
            'POST',
            'https://www.googleapis.com/language/translate/v2?'.$queryUrl,
            $params,
            array("X-HTTP-Method-Override: GET")
        );

 

However, I'm getting a response that:

 

That’s an error. 
Your client does not have permission to get URL /language/translate/v2 from this server.
 That’s all we know.

 


The same code on a different server works without problems. I didn't setup any restrictions for api key:

Zenonas_0-1679047659151.png

What could be the possible causes for this ? Can the request be blocked by the server and how should I check it ? 

0 4 1,202
4 REPLIES 4

The error message you are seeing might be a 403 Forbidden error which means that the server is refusing to fulfill your request. Can you try accessing the server from a different ip address?

I've tried that, but still getting the same results. Is it possible that the restriction is from the google server side ? what could be causing this ?

I suggest you contact Google Cloud support for further assistance. Engineers will have a better visibility of your project

just for reference if someone gets the same error in the future - we needed to update the curl version in the server after that it worked fine.