Проблемы аутентификации при обновлении до SpeechClient v1 ⇐ Php
-
Anonymous
Проблемы аутентификации при обновлении до SpeechClient v1
In the project we have been using the google/cloud package's SpeechClient. I'm now in the process of upgrading it to the not deprecated /V1/SpeechClient, but I'm having an issue where I get the following error
"Google\ApiCore\ApiException: { "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https:\/\/developers.google.com\/identity\/sign-in\/web\/devconsole-project.", "code": 16, "status": "UNAUTHENTICATED", "details": [] } This authentication info works in the previous version, and I've tried to change to the new ways it wants me to authenticate, but I guess I'm not doing it correctly. Any help?
Previous setup:
// $auth is keyfile in an Array format. it matches the design given in here, with the edit fields filled // https://cloud.google.com/iam/docs/keys- ... te-console $speech = new Google\Cloud\Speech\SpeechClient([ 'keyFile' => $auth, ]); Upgraded:
// $auth is the same as above $creds = CredentialsWrapper::build([ 'keyFile' => $auth ]); // Create the speech client $speech = new Google\Cloud\Speech\V1\SpeechClient([ 'credentials' => $creds, ]); ... $operation = $speech->longRunningRecognize( $config, $audio ); // gives me output as normal $operation->getName(); // throws exception at the top of the post $operation->reload();
Источник: https://stackoverflow.com/questions/780 ... hclient-v1
In the project we have been using the google/cloud package's SpeechClient. I'm now in the process of upgrading it to the not deprecated /V1/SpeechClient, but I'm having an issue where I get the following error
"Google\ApiCore\ApiException: { "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https:\/\/developers.google.com\/identity\/sign-in\/web\/devconsole-project.", "code": 16, "status": "UNAUTHENTICATED", "details": [] } This authentication info works in the previous version, and I've tried to change to the new ways it wants me to authenticate, but I guess I'm not doing it correctly. Any help?
Previous setup:
// $auth is keyfile in an Array format. it matches the design given in here, with the edit fields filled // https://cloud.google.com/iam/docs/keys- ... te-console $speech = new Google\Cloud\Speech\SpeechClient([ 'keyFile' => $auth, ]); Upgraded:
// $auth is the same as above $creds = CredentialsWrapper::build([ 'keyFile' => $auth ]); // Create the speech client $speech = new Google\Cloud\Speech\V1\SpeechClient([ 'credentials' => $creds, ]); ... $operation = $speech->longRunningRecognize( $config, $audio ); // gives me output as normal $operation->getName(); // throws exception at the top of the post $operation->reload();
Источник: https://stackoverflow.com/questions/780 ... hclient-v1
Мобильная версия