Search code examples
phplanguage-translationgoogle-cloud-platform

Used Google Cloud Translation API When return response 403 "Daily Limit Exceeded"


The following confirmation is done.

  • Credit card is registered
  • It does not exceed the upper limit of each threshold of API

So, I was able to run normally until yesterday. But I will get an error all the time today.

I use "Cloud Translation API Client Libraries", If there are other points to check, would you please teach me?

$translate = new TranslateClient([
    'projectId' => 'xxxxxxx',
]);
$result = $translate->translate('I am playing Dragon Quest 11 ', [
    'source' => 'en',
    'target' => 'ja',
]);

Solution

  • solved it myself.

    Used to authorized type 'authorized_user'.

    Not so match authentication method.

    My solution is:

    Constructor add option 'keyFilePath' directory.

    $translate = new TranslateClient([
        'projectId' => 'xxxxxxx',
        'keyFilePath' => env('GOOGLE_APPLICATION_CREDENTIALS')
    ]);