2017-07-24 85 views
0

我的配送完成點未接收到accessToken。這是正常的嗎? 當模擬器即時通訊模式下,它並不真正要求登錄到我的授權終點,因此,它不會得到一個訪問令牌。在與Oauth Play Ground進行測試後,我的Oauth正在完美地工作。未在模擬器上接收AccessToken

action.json

{ 
"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); 

RAWfile.txt

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": [] 
        } 
       } 
      } 
     } 
    } 
} 

回答

1

帳戶鏈接在https://console.actions.google.com/

從「概述」菜單項,通過操作控制檯完成的,你需要獲得第5步:帳戶關聯。

在那裏,你可以設置你的終點,需要範圍等

+0

我做到了,但它不模擬器上 – Elo97234c

+0

我更新了必要的信息工作,但使用它的動作仿真心不是:/ – Elo97234c

0

認爲你必須手動完成的那部分 - 如果你在響應看,你會看到一個網址 - 複製/粘貼和運行即,它應該完成帳戶鏈接過程 - https://developers.google.com/actions/identity/account-linking

「在日誌區,複印和debugInfo.sharedDebugInfo.debugInfo領域的網址粘貼到您的網頁瀏覽器,您會被重定向到認證URL您自己的服務器是在API.AI或Actions Console中指定的。「

+0

我張貼的模擬器請求/響應,但我不能古怪看到和URL – Elo97234c

+0

,我去檢查我要比較,並有同樣的問題。出去了,回到它,並重新測試,我得到了debugInfo,所以它似乎隨機 – MadgeMan

+0

嗯,沒有一種方法來報告錯誤。由於我沒有看到URL。現在嘗試了10次:3 – Elo97234c