我从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")});这是返回的signin对象{ '@type':'type.googleapis.com/google.actions.v2.SignInValue',状态:'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"
}可能是因为它仍然是一个尚未发布的测试应用程序吗?
有人能帮我吗?
发布于 2019-12-02 01:06:07
在Google平台帐户中,检查IAM设置并启用对话框Admin
有关更多详细信息的文档:https://cloud.google.com/dialogflow/docs/access-control
https://stackoverflow.com/questions/59119685
复制相似问题