1

I got this sample code from the docs of actions on google account linking with google account. The signin.status is always "ERROR". I have tried on actions console simulator, google assistant app on my phone and on a google home mini with personal results on. But the result is the same in all cases.

const express = require('express');
const bodyParser = require('body-parser');

const {actionssdk, SignIn} = require('actions-on-google');
const app = actionssdk({
  // REPLACE THE PLACEHOLDER WITH THE CLIENT_ID OF YOUR ACTIONS PROJECT
  clientId: <client_id>,
});

// Intent that starts the account linking flow.
app.intent('actions.intent.MAIN', (conv) => {
  conv.ask(new SignIn('To get your account details'));
});
// Create an Actions SDK intent with the `actions_intent_SIGN_IN` event.
app.intent('actions.intent.SIGN_IN', (conv, params, signin) => {
    console.log(signin)
  if (signin.status === 'OK') {
    const payload = conv.user.profile.payload;
    conv.ask(`I got your account details, ${payload.name}. What do you want to do next?`);
  } else {
    conv.ask(`I won't be able to save your data, but what do you want to do next?`);
  }
});

app.intent('actions.intent.TEXT', (conv) => {
    conv.close("bye");
})

//Run server
const expressApp = express().use(bodyParser.json());
expressApp.post('/', function(req,res){
    app(req,res);
});
expressApp.listen(8080,() => {console.log("listening")});

This is the signin object I'm being returned { '@type': 'type.googleapis.com/google.actions.v2.SignInValue', status: 'ERROR' }

EDIT

My actions.json is as follows

{
  "actions": [
    {
      "description": "Default Welcome Intent",
      "name": "MAIN",
      "fulfillment": {
        "conversationName": "fulfilment function"
      },
      "intent": {
        "name": "actions.intent.MAIN",
        "trigger": {
          "queryPatterns": [
            "talk to Care Cat"
          ]
        }
      }
    },
    {
      "description": "Everything Else Intent",
            "name": "allElse",
            "fulfillment": {
                "conversationName": "fulfilment function"
            },
            "intent": {
                "name": "actions.intent.TEXT"
            }
    }
  ],
  "conversations": {
    "fulfilment function": {
      "name": "fulfilment function",
      "url": <url>
    }
  },
  "locale": "en"
}

Could it be because it is still a test app which is not published yet?

Can someone help me with this?

Anthony Mooz
  • 3,553
  • 1
  • 10
  • 10
  • Accountlinking should work fine for test apps, have you already configured accountlinking in your Google Assistant project before using the code? https://developers.google.com/assistant/identity/google-sign-in#configure_the_project – Jordi Dec 01 '19 at 11:21
  • I did. That's how I got my client ID and using it in the code. Is there anything I'm missing in my actions.json file? – Sai Ram Chittala Dec 01 '19 at 18:43

1 Answers1

0

In your Google Cloud Platform Account, check your IAM settings and enable the Dialogflow API Admin

Documentation for more details: https://cloud.google.com/dialogflow/docs/access-control

Anthony Mooz
  • 3,553
  • 1
  • 10
  • 10