В проекте мы использовали SpeechClient пакета google/cloud. Сейчас я обновляю его до не устаревшей версии /V1/SpeechClient, но у меня возникла проблема, связанная со следующей ошибкой
"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": []
}
Эта информация для аутентификации работает в предыдущей версии, и я пытался перейти на новые способы аутентификации, но, похоже, я делаю это неправильно. Любая помощь?
Предыдущая настройка:
// $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
$auth = [
"type" => "service_account",
"project_id" => "",
"private_key_id" => "",
"private_key" => "-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----",
"client_email" => "",
"client_id" => "",
"auth_uri" => "https://accounts.google.com/o/oauth2/auth",
"token_uri" => "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url" => "https://www.googleapis.com/robot/v1/met ... ccount.com",
];
$speech = new Google\Cloud\Speech\SpeechClient([
'keyFile' => $auth,
]);
// Same auth used for storageClient
$storage = new Google\Cloud\Storage\StorageClient([
'keyFile' => $auth
]);
Обновление:
// $auth is the same as above
$creds = CredentialsWrapper::build([
'keyFile' => $auth
]);
// Create the speech client
$speech = new Google\Cloud\Speech\V1\SpeechClient([
'credentials' => $creds,
]);
// old auth still used for Storage
$storage = new Google\Cloud\Storage\StorageClient([
'keyFile' => $auth
]);
...
$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
Проблемы аутентификации при обновлении до SpeechClient v1 ⇐ Php
Кемеровские программисты php общаются здесь
-
Anonymous
1713251976
Anonymous
В проекте мы использовали SpeechClient пакета google/cloud. Сейчас я обновляю его до не устаревшей версии /V1/SpeechClient, но у меня возникла проблема, связанная со следующей ошибкой
"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": []
}
Эта информация для аутентификации работает в предыдущей версии, и я пытался перейти на новые способы аутентификации, но, похоже, я делаю это неправильно. Любая помощь?
Предыдущая настройка:
// $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-create-delete#iam-service-account-keys-create-console
$auth = [
"type" => "service_account",
"project_id" => "",
"private_key_id" => "",
"private_key" => "-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----",
"client_email" => "",
"client_id" => "",
"auth_uri" => "https://accounts.google.com/o/oauth2/auth",
"token_uri" => "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url" => "https://www.googleapis.com/robot/v1/metadata/.gserviceaccount.com",
];
$speech = new Google\Cloud\Speech\SpeechClient([
'keyFile' => $auth,
]);
// Same auth used for storageClient
$storage = new Google\Cloud\Storage\StorageClient([
'keyFile' => $auth
]);
Обновление:
// $auth is the same as above
$creds = CredentialsWrapper::build([
'keyFile' => $auth
]);
// Create the speech client
$speech = new Google\Cloud\Speech\V1\SpeechClient([
'credentials' => $creds,
]);
// old auth still used for Storage
$storage = new Google\Cloud\Storage\StorageClient([
'keyFile' => $auth
]);
...
$operation = $speech->longRunningRecognize(
$config,
$audio
);
// gives me output as normal
$operation->getName();
// throws exception at the top of the post
$operation->reload();
Подробнее здесь: [url]https://stackoverflow.com/questions/78099692/authentication-problems-when-upgrading-to-speechclient-v1[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия