0

My Fulfilment End Point isnt receiving accessToken. Is this normal? Becouse when im on the simulator it doesnt really ask to login to my authorization end point thus, it wont get a access token. My Oauth is working perfectly after tesing with Oauth Play Ground.

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
        }
    }
}

Fulfilment Received Request

The request was logged into a text file

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
)

Simulator Request

{
    "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
            }
        }
    }
}

Simulator Response

{
    "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": []
                    }
                }
            }
        }
    }
}
Elo97234c
  • 163
  • 1
  • 4
  • 15

2 Answers2

1

Account linking is done through the Actions Console at https://console.actions.google.com/

From the "Overview" menu item, you'll need to get to step 5: Account Linking.

In there, you can set your endpoints, scopes required, etc.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
0

Think you have to manually complete that part - if you look in the response, you'll see a URL - copy/paste and run that, it should complete the account linking process - https://developers.google.com/actions/identity/account-linking

"In the Log area, copy and paste the URL from the debugInfo.sharedDebugInfo.debugInfo field into your web browser. You will be redirected to the authentication URL for your own server that was specified in API.AI or in the Actions Console."

Madgeni
  • 65
  • 4
  • I posted the Simulator Request/Response but i cant see and URLs – Elo97234c Jul 25 '17 at 18:51
  • Weirdly, I went to check mine to compare, and had the same issue. Went out, went back into it, and retested, and I got the debugInfo, so it seems random – Madgeni Jul 25 '17 at 20:10
  • hmm, isnt there a way to report bugs. Becouse i dont see a URL at all. Tried over 10 times now :3 – Elo97234c Jul 25 '17 at 20:29