Authenticate user in google Assistant using actions sdk

Viewed 652

As per the google actions sdk documentation here https://developers.google.com/actions/identity/account-linking

I have followed all the steps of Enable Account Linking. When the any intent is called I am checking the user is signed in or not by

let accessToken = app.getUser().accessToken;
  if ('' + accessToken === 'undefined') {
   console.log('Inside not logged In');
    app.askForSignIn();
 }

and which sends the response as

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

}

which should invoke authentication flow at the device. Though the google assistant is saying as below.

{
"response": "test application isn’t responding right now. Try again soon.\n",
"conversationToken": "GhBzaW11bGF0b3JfZGV2aWNl",
"audioResponse": "//NExAASW...",
"debugInfo": {},
"visualResponse": {}
}

I have tried all the things given in documentation. Could you please help how to implement log in functionality using Actions SDK and not API.AI in google assistant?

Below is the response from API.AI to google assistant to invoke authentication flow which is working.

here is the response which was generated by API.AI to invoke user authentication.

{
"response": "It looks like your test app account is not linked yet",
"conversationToken": "GhBzaW11bGF0b3JfZDV2aWNl",
"audioResponse": "//NExAAQ+...",
"debugInfo": {
    "sharedDebugInfo": [
        {
            "name": "Account Linking Url",
            "debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider=pathway-171404_dev&scopes=test&return_url=https://www.google.com/"
        }
    ]
}
}

Is there any way we can generate this response in Actions SDK in node.js file?

Actions.json file:

{
 "actions": [
   {
     "description": "Launch intent",
     "name": "MAIN",
     "fulfillment": {
       "conversationName": "mainConversation"
     },
     "intent": {
       "name": "actions.intent.MAIN"
     }
   },
   {
     "description": "Sign In intent",
     "name": "SIGN_IN",
     "fulfillment": {
       "conversationName": "mainConversation"
     },
     "intent": {
       "name": "actions.intent.SIGN_IN"
     }
   }
 ],
 "conversations": {
   "mainConversation": {
     "name": "mainConversation",
     "url": "https://4541d296.ngrok.io/pathway-171404/us-central1/conversationComponent",
     "fulfillmentApiVersion": 2
   }
 }
}
0 Answers
Related