在Google Actions v2中请求帐户关联失败“ReferenceError:SignIn未定义”

时间:2018-05-23 21:02:04

标签: actions-on-google

我正在迁移代码,我无法让我的帐户将登录过程连接起来。看完文档和代码后,我没有看到我调用SignIn()的方式有任何错误。 我还确保更新action.json并在其中添加链接内容的v2帐户,并且我的应用程序始终有帐户链接工作,因此控制台中的帐户链接部分是最新的。我正在使用Action SDK而不是Dialogflow。

const {actionssdk} = require('actions-on-google');
const app = actionssdk({debug: true});
app.intent('actions.intent.MAIN', conv => {
  conv.ask(new SignIn())
})

app.intent('actions.intent.SIGN_IN', (conv, input, signin) => {
  if (signin.status === 'OK') {
    const access = conv.user.access.token // possibly do something with access token
     conv.ask('Great, thanks for signing in! 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?`)
    }
})
module.exports.assistant = app;

日志:

ReferenceError: SignIn is not defined
    at app.intent.conv (/usr/local/lucida/web/client-apps/src/routes/google_home.js:4:16)
    at Function.<anonymous> (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/service/actionssdk/actionssdk.js:138:23)
    at next (native)
    at /usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/service/actionssdk/actionssdk.js:22:71
    at __awaiter (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/service/actionssdk/actionssdk.js:18:12)
    at Function.handler (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/service/actionssdk/actionssdk.js:85:16)
    at Object.<anonymous> (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/assistant.js:55:32)
    at next (native)
    at /usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/assistant.js:22:71
    at __awaiter (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/assistant.js:18:12)
    at standard (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/assistant.js:51:41)
    at /usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/framework/express.js:23:13
    at omni (/usr/local/lucida/web/client-apps/node_modules/actions-on-google/dist/assistant.js:44:53)
    at Layer.handle [as handle_request] (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/layer.js:95:5)
    at /usr/local/lucida/web/client-apps/node_modules/express/lib/router/index.js:281:22
    at param (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/index.js:354:14)
    at param (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/index.js:410:3)
    at next (/usr/local/lucida/web/client-apps/node_modules/express/lib/router/index.js:275:10)

0 个答案:

没有答案