我的Fulfillment End Point没有收到accessToken。这是正常的吗? 当我在模拟器上它并没有真正要求登录我的授权终点时,因此,它不会获得访问令牌。在与Oauth Play Ground进行测试后,我的Oauth工作得很好。
{
"accountLinking": {
"clientId": "", // SENSITIVE INFORMATION BLANK
"clientSecret": "", // SENSITIVE INFORMATION BLANK
"grantType": "AUTH_CODE",
"authenticationUrl": "", // SENSITIVE INFORMATION BLANK
"accessTokenUrl": "" // SENSITIVE INFORMATION BLANK
},
"actions": [{
"description": "",
"name": "MAIN",
"fulfillment": {
"conversationName": "PASS TEXT"
},
"intent": {
"name": "actions.intent.MAIN",
"trigger": {
"queryPatterns": [
"talk to APP NAME"
]
}
}
}],
"conversations": {
"PASS TEXT": {
"name": "PASS TEXT",
"url": "" // MY FULFILLMENT END POINT
"fulfillmentApiVersion": 2
}
}
}
请求已记录到文本文件
jsondata = file_get_contents('php://input');
$postdata = json_decode($jsondata, true);
$RAWfile = print_r($postdata, true);
file_put_contents('RAWfile.txt', $RAWfile);
Array
(
[user] => Array
(
[userId] => APhe68HH0PP0nTYnY8jBJed31WqF
[locale] => en-US
)
[conversation] => Array
(
[conversationId] => 1500924702161
[type] => NEW
)
[inputs] => Array
(
[0] => Array
(
[intent] => actions.intent.MAIN
[rawInputs] => Array
(
[0] => Array
(
[inputType] => VOICE
[query] => ask APP NAME to bla bla
)
)
[arguments] => Array
(
[0] => Array
(
[name] => trigger_query
[rawText] => bla bla
[textValue] => bla bla
)
)
)
)
[surface] => Array
(
[capabilities] => Array
(
[0] => Array
(
[name] => actions.capability.AUDIO_OUTPUT
)
)
)
[device] => Array
(
)
[isInSandbox] => 1
)
{
"query": "bla bla",
"accessToken": "ya29.Gl2TBLrbKjcgK-6jsARmc4Zvkx8qT2X2rE3vsuwEVc_Ey2-q4OUqNWaJPBlXzIjONb_u2MbrE-rgnfwQSZpbZReXsmZjoGOy18Tvp7xzzSJb-cW9SjZ32uLBaKO7vGE",
"expectUserResponse": true,
"conversationToken": "CiZDIzU5O...",
"surface": "GOOGLE_HOME",
"inputType": "VOICE",
"locale": "en-US",
"location": {
"address": "Googleplex, Mountain View, CA, United States",
"position": {
"lat": 37.421980615353675,
"lng": -122.08419799804688
},
"zipCode": "94043",
"city": "Mountain View"
},
"debugInfo": {
"assistantToAgentDebug": {
"assistantToAgentJson": {
"user": {
"userId": "bla",
"locale": "en-US"
},
"conversation": {
"conversationId": "1501004260313",
"type": "NEW"
},
"inputs": [
{
"intent": "actions.intent.MAIN",
"rawInputs": [
{
"inputType": "VOICE",
"query": "bla"
}
],
"arguments": [
{
"name": "trigger_query",
"rawText": "bla",
"textValue": "bla"
}
]
}
],
"surface": {
"capabilities": [
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
},
"device": {},
"isInSandbox": true
}
}
}
}
{
"response": "Sure. Here's the test version of bla.\nsure\n",
"conversationToken": "bla",
"audioResponse": "//NExAASS...",
"debugInfo": {
"agentToAssistantDebug": {
"agentToAssistantJson": {
"conversationToken": "{\"state\":null,\"data\":{}}",
"expectUserResponse": false,
"finalResponse": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "sure",
"displayText": "sure"
}
}
],
"suggestions": []
}
}
}
}
}
}
答案 0 :(得分:1)
答案 1 :(得分:0)
认为你必须手动完成该部分 - 如果你查看回复,你会看到一个URL - 复制/粘贴并运行它,它应该完成帐户链接过程 - https://developers.google.com/actions/identity/account-linking
"在“日志”区域中,将debugInfo.sharedDebugInfo.debugInfo字段中的URL复制并粘贴到Web浏览器中。您将被重定向到API.AI或操作控制台中指定的您自己的服务器的身份验证URL。"