【问题标题】:Validation errors when linking authentication with Dialogflow / Google Action将身份验证与 Dialogflow / Google Action 链接时出现验证错误
【发布时间】:2017-12-05 19:59:31
【问题描述】:

我们正在尝试让 DialogFlow / Google Actions 链接到对话中的外部 OAuth 帐户。遵循示例后,我们不断收到我们不知道如何解决的请求验证错误。据我所知,我们正在按部就班地做所有事情。

我们的问题:

  1. 为什么 DialogFlow 不启动身份验证过程?
  2. 记录的webhook response for requesting the sign-in helper 与标准DialogFlow webhook response 的架构不同。登录助手响应是否应该用于其他用途?...

我们尝试过的事情:

  • 我们已根据the documentation 配置了我们的应用和 OAuth 凭据
  • 我们已验证可以通过 OAuth 2.0 游乐场从服务中获取 OAuth 令牌
  • 我们已在 Action 上启用交易。

我们的意图代码如下:

const { DialogflowApp } = require('actions-on-google'); 
const { ActionsSdkApp } = require('actions-on-google');

function processV2Request (request, response) {
  ...
  let app = new DialogflowApp({request: request, response: response});
  let sdkapp = new ActionsSdkApp({request: request, response: response});
  const actionHandlers = {
    'pto': () => {
        app.askForSignIn();
    }
    ...
  }
  ...
}

当我们执行这个意图时,我们会收到以下关于 speech 字段的调试错误消息。

"agentToAssistantJson": {
  "message": "Unexpected apiai response format: Empty speech response",
  "apiResponse": {
    "id": "751e4716-a94d-4d11-908d-3ee193092d9c",
    "timestamp": "2017-12-05T19:52:01.962Z",
    "lang": "en-us",
    "result": {},
    "status": {
      "code": 206,
      "errorType": "partial_content",
      "errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: speech in message google.cloud.dialogflow.v2beta1.WebhookResponse."
    }
  }
}

如果我们尝试使用 ActionsSdkApp sdkapp.askForSignIn(),则会收到关于 conversation_token 字段的错误消息。

"agentToAssistantJson": {
  "message": "Unexpected apiai response format: Empty speech response",
  "apiResponse": {
    "id": "7de79093-6db8-44ee-8717-16b0f317174c",
    "timestamp": "2017-12-05T19:54:29.709Z",
    "lang": "en-us",
    "result": {},
    "status": {
      "code": 206,
      "errorType": "partial_content",
      "errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: conversation_token in message google.cloud.dialogflow.v2beta1.WebhookResponse."
    },
  }
}

如果有帮助,这里是我们的 package.json。这是 DialogFlow 最近的默认设置,升级版为 actions-on-google

{
  "name": "dialogflowFirebaseFulfillment",
  "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "~6.0"
  },
  "scripts": {
    "start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
    "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
  },
  "dependencies": {
    "actions-on-google": "^1.6.x",
    "firebase-admin": "^4.2.1",
    "firebase-functions": "^0.5.7",
    "apiai": "^4.0.3"
  }
}

【问题讨论】:

  • 您是否有意使用 Dialogflow v2 API? (不同于 Actions-on-Google v2 API。)
  • 我们已经在 v1 和 v2 API 上进行了尝试,但无论哪种方式都会出现问题。 v1 是推荐的版本吗?
  • Dialogflow v2 仍处于测试阶段,不推荐用于生产。主要是想缩小范围。

标签: actions-on-google dialogflow-es


【解决方案1】:

我们确定,除了为应用启用事务外,您还必须将Development Sandbox 切换为Active

【讨论】:

    猜你喜欢
    • 2020-09-18
    • 1970-01-01
    • 2018-09-10
    • 1970-01-01
    • 2014-06-07
    • 2017-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多