403 error when API request from authorised domain ๐Ÿคจ

Hi! Not sure if this is the right place to ask but here I go. I'm trying to configure a translation system with the Cloud Translation API and would like to restrict its usage for a specific domain.
 
Here's my code:

 

$translate = new TranslateClient([
    'key' => 'my-api-key',
]);

$translation = $translate->translate('Hello world!', [
    'target' => 'fr',
]);

 

 
My key is configured as follows with only one domain (https://example.com) and its subdomains (https://*.example.com๐Ÿ˜ž
 
My code works perfectly when I remove all the restrictions, I'm able to make requests and translate strings. Yet when I enable them and make requests from my domain, I get a 403 error as if I wasn't sending them from the right domain:

Been stuck on this for a few days and would love some help because I have no idea what I'm doing wrong. Thanks!
1 1 567
1 REPLY 1

Hi @morceaudebois ,

I would request you to revisit this page: 

 
I believe the issue could be related to the HTTP referrers you are manually adding in the UI.
 
Also, have you got a chance to check the cloud audit logs to see if there are any specific errors reported on the Google Cloud end regarding this?
 
Kind Regards,
SanketK

Top Labels in this Space