Google Assistant - Account linking with Google Sign-In

你离开我真会死。 提交于 2019-12-11 06:19:27

问题


I have an Express app which supports Google authentication and authorization via passport. 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

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

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

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!)

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:

  "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.

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!


回答1:


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.

To make your "Get Signin" Intent get the sign-in event, set the "Event" field to actions_intent_SIGN_IN. (Note the similarity to the Intent name you saw in the simulator, but using underscores instead of dots.)

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. 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).



来源:https://stackoverflow.com/questions/52104355/google-assistant-account-linking-with-google-sign-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!