Authenticate user to Google Assistant using sdk actions

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

I have followed all the "Enable Account Linking" steps. When any intent is called, I check if the user is logged in or not,

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 the authentication thread on the device. Although the google assistant says like below.

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

      

I've tried everything given in the documentation. Could you please help how to implement login functionality using Actions SDK and not API.AI in Google Assistant?

Below is the API.I response for google helper to trigger an authentication flow.

here is the response that 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 a way to generate this response in the Action SDK in a 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
   }
 }
}

      

+3


source to share





All Articles