简体   繁体   English

无法创建会话客户端对话流

[英]Can't create session client dialogflow

I'm trying to set up Dialogflow on a php backend.我正在尝试在 php 后端设置 Dialogflow。 According to the documentation: https://googleapis.dev/nodejs/dialogflow/latest/v2beta1.SessionsClient.html根据文档: https : //googleapis.dev/nodejs/dialogflow/latest/v2beta1.SessionsClient.html

I should be able to pass as a parameter the path of the json key file I previously generated with the Google Cloud Console to access DialogFlow's API.我应该能够将我之前使用 Google Cloud Console 生成的 json 密钥文件的路径作为参数传递以访问 DialogFlow 的 API。

$path = dirname(__DIR__, 2) . '\_________-_______-____________.json';
$config = [
  'keyFilename' => $path,
];
$sessionsClient = new SessionsClient($config);

I keep getting this error: Could not construct ApplicationDefaultCredentials我不断收到此错误: Could not construct ApplicationDefaultCredentials

I double checked the path using the file_get_contents method, it's valid.我使用file_get_contents方法仔细检查了路径,它是有效的。

Any idea ?任何的想法 ?

Something is wrong with the doc.文档有问题。

Using the key credentials instead of keyFilename did the work.使用密钥credentials而不是keyFilename完成了工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM