Google Actions-on-google帐户关联登录状态始终为“ ERROR”

时间:2019-11-30 19:50:43

标签: node.js google-cloud-platform actions-on-google account-linking

我从链接到google帐户的google帐户操作文档中获得了此示例代码。 signin.status始终为“ ERROR”。我在手机和Google Home mini上尝试了动作控制台模拟器,Google Assistant应用,并启用了个人结果。但是结果在所有情况下都是相同的。

const express = require('express');
const bodyParser = require('body-parser');

const {actionssdk, SignIn} = require('actions-on-google');
const app = actionssdk({
  // REPLACE THE PLACEHOLDER WITH THE CLIENT_ID OF YOUR ACTIONS PROJECT
  clientId: <client_id>,
});

// Intent that starts the account linking flow.
app.intent('actions.intent.MAIN', (conv) => {
  conv.ask(new SignIn('To get your account details'));
});
// Create an Actions SDK intent with the `actions_intent_SIGN_IN` event.
app.intent('actions.intent.SIGN_IN', (conv, params, signin) => {
    console.log(signin)
  if (signin.status === 'OK') {
    const payload = conv.user.profile.payload;
    conv.ask(`I got your account details, ${payload.name}. What do you want to do next?`);
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`);
  }
});

app.intent('actions.intent.TEXT', (conv) => {
    conv.close("bye");
})

//Run server
const expressApp = express().use(bodyParser.json());
expressApp.post('/', function(req,res){
    app(req,res);
});
expressApp.listen(8080,() => {console.log("listening")});

这是我返回的登录对象 {'@type':'type.googleapis.com/google.actions.v2.SignInValue', 状态:“错误”}

编辑

我的actions.json如下

{
  "actions": [
    {
      "description": "Default Welcome Intent",
      "name": "MAIN",
      "fulfillment": {
        "conversationName": "fulfilment function"
      },
      "intent": {
        "name": "actions.intent.MAIN",
        "trigger": {
          "queryPatterns": [
            "talk to Care Cat"
          ]
        }
      }
    },
    {
      "description": "Everything Else Intent",
            "name": "allElse",
            "fulfillment": {
                "conversationName": "fulfilment function"
            },
            "intent": {
                "name": "actions.intent.TEXT"
            }
    }
  ],
  "conversations": {
    "fulfilment function": {
      "name": "fulfilment function",
      "url": <url>
    }
  },
  "locale": "en"
}

是因为它仍然是尚未发布的测试应用吗?

有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

在您的Google Cloud Platform帐户中,检查您的IAM设置并启用 Dialogflow API管理员

文档以获取更多详细信息:https://cloud.google.com/dialogflow/docs/access-control