Elo97234c
Elo97234c

Reputation: 193

Not Receiving Access Token

I've implemented account linking successfully but im not recving any accessTokens to my fulfillment end point.
The AccessToken field is empty in the json sent to my fulfilment end point.

Json Received to Fulfillment

 Array
 (
[user] => Array
    (
        [userId] => 1502895338751
        [locale] => en-US
    )

[conversation] => Array
    (
        [conversationId] => 1502895338751
        [type] => ACTIVE
        [conversationToken] => {"state":null,"data":{}}
    )

[inputs] => Array
    (
        [0] => Array
            (
                [intent] => actions.intent.TEXT
                [rawInputs] => Array
                    (
                        [0] => Array
                            (
                                [inputType] => KEYBOARD
                                [query] => talk to APPNAME
                            )

                    )

                [arguments] => Array
                    (
                        [0] => Array
                            (
                                [name] => text
                                [rawText] => talk to APPNAME
                                [textValue] => talk to APPNAME
                            )

                    )

            )

    )

[surface] => Array
    (
        [capabilities] => Array
            (
                [0] => Array
                    (
                        [name] => actions.capability.AUDIO_OUTPUT
                    )

                [1] => Array
                    (
                        [name] => actions.capability.SCREEN_OUTPUT
                    )

            )

    )

[device] => Array
    (
    )

[isInSandbox] => 1
)

Not quite sure what to do at this point, stuck here for over a week now. I contacted AOG Support, but they dont seem to undestand what im trying to say :/

enter image description here

My response from the fulfillment if the accessToken is not found

    header('Content-Type: application/json');
    $askToken = array (
  'conversationToken' => '{"state":null,"data":{}}',
  'expectUserResponse' => true,
  'expectedInputs' => 
  array (
    0 => 
    array (
      'inputPrompt' => 
      array (
        'initialPrompts' => 
        array (
          0 => 
          array (
            'textToSpeech' => 'PLACEHOLDER_FOR_SIGN_IN',

          ),
        ),
        'noInputPrompts' => 
        array (
        ),
      ),
      'possibleIntents' => 
      array (
        0 => 
        array (
          'intent' => 'actions.intent.SIGN_IN',
          'inputValueData' => 
         (object) array (
          ),
        ),
      ),
    ),
  ),
);
 echo json_encode($askToken);
 exit();

Upvotes: 0

Views: 196

Answers (1)

Prisoner
Prisoner

Reputation: 50701

Since you're not using API.AI, you need to initiate the request for account linking during fulfillment of one of your intents - probably your welcome intent. The JSON you need to send back in this case looks something like


{
  "conversationToken": "{\"state\":null,\"data\":{}}",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "initialPrompts": [
          {
            "textToSpeech": "PLACEHOLDER_FOR_SIGN_IN"
          }
        ],
        "noInputPrompts": []
      },
      "possibleIntents": [
        {
          "intent": "actions.intent.SIGN_IN",
          "inputValueData": {}
        }
      ]
    }
  ]
}

Upvotes: 1

Related Questions