简体   繁体   English

Google 助理 - 与 Google Sign-In 关联的帐户

[英]Google Assistant - Account linking with Google Sign-In

I have an Express app which supports Google authentication and authorization via passport.我有一个 Express 应用程序,它支持通过护照进行 Google 身份验证和授权。 I have begun integrating it with Google Assistant and things were going quite well but I am having trouble with the account linking as described at https://developers.google.com/actions/identity/google-sign-in#start_the_authentication_flow我已经开始将它与 Google Assistant 集成,事情进展得很顺利,但我在链接帐户时遇到了问题,如https://developers.google.com/actions/identity/google-sign-in#start_the_authentication_flow 所述

Using the method in the docs at https://codelabs.developers.google.com/codelabs/actions-2/#4 I was able to get user details but when I try to modify to support使用https://codelabs.developers.google.com/codelabs/actions-2/#4上的文档中的方法,我能够获取用户详细信息,但是当我尝试修改以支持

app.intent('Start Signin', conv => {
  conv.ask(new SignIn('To get your account details'))
})

and

app.intent('Get Signin', (conv, params, signin) => { ...}

the dialogflow always falls back to my default fallback intent and I get an error in Express console对话流总是回退到我的默认回退意图,我在 Express 控制台中收到错误

Error: Dialogflow IntentHandler not found for intent: Default Fallback Intent

My dialogflow intent is set to use webhook and other intents work fine (until I add these sign-in intents!)我的对话流意图设置为使用 webhook,其他意图工作正常(直到我添加这些登录意图!)

Reading this thread Dialogflow IntentHandler not found for intent: myIntent (Dialogflow V2) it was suggested that the intent name rather than the action name is used so I check my Actions on Google simulator and the request contains:阅读此线程Dialogflow IntentHandler not found for Intent: myIntent (Dialogflow V2)有人建议使用意图名称而不是操作名称,因此我检查了我在 Google 模拟器上的操作,请求包含:

  "inputs": [
    {
      "intent": "actions.intent.SIGN_IN",
      "rawInputs": [
        {
          "inputType": "KEYBOARD"
        }
      ],
      "arguments": [
        {
          "name": "SIGN_IN",
          "extension": {
            "@type": "type.googleapis.com/google.actions.v2.SignInValue",
            "status": "OK"
          }
        }
      ]
    }
  ],

so I tried updating my Dialogflow intent name to actions.intent.SIGN_IN and modifying the intent name in my Express app accordingly but it doesn't make any difference.所以我尝试将我的 Dialogflow 意图名称更新为actions.intent.SIGN_IN并相应地修改我的 Express 应用程序中的意图名称,但没有任何区别。

The simulator response includes:模拟器响应包括:

"responseMetadata": {
    "status": {
      "code": 14,
      "message": "Webhook error (206)"
    },

but I'm not sure if that is just because for some reason the intent names are not matching up.但我不确定这是否仅仅是因为出于某种原因意图名称不匹配。 Any help much appreciated!非常感谢任何帮助!

在此处输入图片说明

As you speculate in the comments, the issue is that your "Get Signin" Intent isn't registered to get the event indicating that the user has signed in (or failed to).正如您在评论中推测的那样,问题在于您的“获取登录”意图未注册以获取指示用户已登录(或未能登录)的事件。 Since there is no such Intent setup, it ends up calling the Fallback Intent, which apparently doesn't have an Intent Handler registered in your webhook.由于没有这样的 Intent 设置,它最终会调用 Fallback Intent,它显然没有在您的 webhook 中注册 Intent Handler。

To make your "Get Signin" Intent get the sign-in event, set the "Event" field to actions_intent_SIGN_IN .要使您的“获取登录”意图获得登录事件,请将“事件”字段设置为actions_intent_SIGN_IN (Note the similarity to the Intent name you saw in the simulator, but using underscores instead of dots.) (注意与您在模拟器中看到的 Intent 名称相似,但使用下划线而不是点。)

As an aside, the simulator was showing you what the communication between the Assistant and Dialogflow looks like, so it can be somewhat confusing to understand what Dialogflow is doing with it.顺便说一句,模拟器向您展示了 Assistant 和 Dialogflow 之间的通信是什么样的,因此理解 Dialogflow 用它做什么可能会有些混乱。 It didn't have anything to do with the name of your Intent or anything else.它与您的意图或其他任何名称的名称无关。

Finally, it often isn't necessary to do this check.最后,通常不需要进行此检查。 You will know if the user is signed in because either the auth token has been set or the id token has been set (depending on your method of Account Linking).您将知道用户是否因为已设置身份验证令牌或已设置 id 令牌(取决于您的帐户链接方法)而登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM