DialogFlow:成功关联Google帐户后,JSON中缺少“用户”属性

时间:2018-07-18 04:57:15

标签: actions-on-google dialogflow

因此,在我的应用中成功Google Account linking之后,我使用Android设备对其进行了测试,没有任何问题。我使用了“ in conversation prompt”技术来请求用户进行身份验证以进一步进行操作。换句话说,我能够使用有效的accessToken(以及其他信息)成功地从Dialogflow接收响应的“用户”属性。

现在,我在Google Home设备上进行了尝试。该设备配置了与我在Android移动设备上使用的相同的电子邮件ID。当我调用G.Home时,它成功加载了该应用程序。但是这里缺少的部分是用户属性(下面的JSON)中的accessToken。在上述情况下,我假设以下情况:

  1. 由于我已经在Android移动设备上成功登录,因此下次我尝试在同一设备上调用该应用程序时,该应用程序不会提示您“登录”,因为它已经具有accessToken(直到过期)。并且由于我在G.Home设备上使用了相同的gmail地址,所以我也应该获得相同的accessToken。

  2. 只要使用相同的gmail地址,我自己使用哪种设备/界面进行Google身份验证都无所谓,如果访问令牌未过期,我将始终获得它。

我共享的上述链接中详细介绍了整个Google帐户链接的设置/配置。这是我分别在G.Home和Android设备上收到的JSON:

{
  "originalRequest": {
    "source": "google",
    "version": "2",
    "data": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          }
        ]
      },
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "continue",
              "inputType": "VOICE"
            }
          ],
          "arguments": [
            {
              "rawText": "continue",
              "textValue": "continue",
              "name": "text"
            }
          ],
          "intent": "actions.intent.TEXT"
        }
      ],
      "user": {
        "lastSeen": "2018-07-17T10:33:57Z",
        "locale": "en-US",
        "userId": "15229245xxx"
      },
      "conversation": {
        "conversationId": "153182806xxx",
        "type": "ACTIVE",
        "conversationToken": "[\"disclaimer_option\"]"
      },
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            },
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.WEB_BROWSER"
            }
          ]
        }
      ]
    }
  },
  "id": "9459d297-4746-4ffe-99fa-xxx",
  "timestamp": "2018-07-17T11:49:02.693Z",
  "lang": "en-us",
  "result": {
    "source": "agent",
    "resolvedQuery": "continue",
    "speech": "",
    "action": "v00.authentication.pin",
    "actionIncomplete": false,
    "parameters": {
      "CallEnum": "Login"
    },
    "contexts": [
      {
        "name": "disclaimer_option",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "pin",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 1
      },
      {
        "name": "google_assistant_input_type_voice",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_audio_output",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_media_response_audio",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      }
    ],
    "metadata": {
      "intentName": "v00.authentication.pin",
      "isResponseToSlotfilling": false,
      "intentId": "146f0d7d-0194-43cb-90e4-xxx",
      "webhookUsed": "true",
      "webhookForSlotFillingUsed": "false",
      "nluResponseTime": 87
    },
    "fulfillment": {
      "speech": "",
      "messages": []
    },
    "score": 1
  },
  "status": {
    "code": 200,
    "errorType": "success"
  },
  "sessionId": "15318280xxx"
}

{
  "originalRequest": {
    "source": "google",
    "version": "2",
    "data": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          }
        ]
      },
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "Continue",
              "inputType": "TOUCH"
            }
          ],
          "arguments": [
            {
              "rawText": "Continue",
              "textValue": "Continue",
              "name": "text"
            }
          ],
          "intent": "actions.intent.TEXT"
        }
      ],
      "user": {
        "lastSeen": "2018-07-17T09:44:08Z",
        "accessToken": "6IlPNz0YFb_stP0quM1xxx",
        "locale": "en-US",
        "userId": "15229245xxx"
      },
      "conversation": {
        "conversationId": "153182082xxx",
        "type": "ACTIVE",
        "conversationToken": "[\"disclaimer_option\"]"
      },
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.WEB_BROWSER"
            },
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            }
          ]
        }
      ]
    }
  },
  "id": "ae2e3ff8-f351-497b-9429-xxx",
  "timestamp": "2018-07-17T09:47:54.999Z",
  "lang": "en-us",
  "result": {
    "source": "agent",
    "resolvedQuery": "Continue",
    "speech": "",
    "action": "v00.authentication.pin",
    "actionIncomplete": false,
    "parameters": {
      "CallEnum": "Login"
    },
    "contexts": [
      {
        "name": "google_assistant_input_type_touch",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "pin",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 1
      },
      {
        "name": "disclaimer_option",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_screen_output",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_audio_output",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_media_response_audio",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_web_browser",
        "parameters": {
          "CallEnum": "Login",
          "CallEnum.original": ""
        },
        "lifespan": 0
      }
    ],
    "metadata": {
      "intentName": "v00.authentication.pin",
      "isResponseToSlotfilling": false,
      "intentId": "146f0d7d-0194-43cb-90e4-xxx",
      "webhookUsed": "true",
      "webhookForSlotFillingUsed": "false",
      "nluResponseTime": 87
    },
    "fulfillment": {
      "speech": "",
      "messages": []
    },
    "score": 1
  },
  "status": {
    "code": 200,
    "errorType": "success"
  },
  "sessionId": "153182082xxx"
}

我的问题是,当我使用Google Home设备时,在哪里可以得到accessToken

0 个答案:

没有答案