node.js - actions-on-google 帐户链接登录状态始终为“错误”
问题描述
我从与 google 帐户链接的 google 帐户操作文档中获得了此示例代码。signin.status 始终为“错误”。我已经尝试过操作控制台模拟器、手机上的谷歌助手应用程序以及带有个人搜索结果的谷歌家庭迷你版。但结果在所有情况下都是一样的。
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', status: 'ERROR' }
编辑
我的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"
}
难道是因为它仍然是一个尚未发布的测试应用程序?
有人可以帮我弄这个吗?
解决方案
在您的 Google Cloud Platform 帐户中,检查您的 IAM 设置并启用Dialogflow API Admin
有关更多详细信息的文档:https ://cloud.google.com/dialogflow/docs/access-control
推荐阅读
- python - Matplotlib 2.2.2 无法 xkcdify 绘图
- visual-studio-code - 在 VS Code 中按 Enter 时是否可以避免进入缩进级别?
- jax-rs - 从 JAX-RS ContainerRequestFilter 和 ContainerResponseFilter 中提取资源方法名称
- php - preg_slit 不能正常工作?- php
- sql-server - 谁能告诉我这有什么问题?我实际上正在尝试在表中搜索空值,如果可能的话建议我一种有效的方法来做到这一点
- xcode - 将tableView中的值添加到标签Swift4
- c# - 如何检测第二个屏幕
- sql-server - 群集共享卷 - SQL - 故障转移群集节点
- graphql-js - 如何在以编程方式定义的模式中为参数设置默认值?
- sql - 用于查找唯一列和连接两列结果的 SQL 查询