actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 193 forks source link

Infinite Loop on askForSignIn #104

Closed maxmatthews closed 6 years ago

maxmatthews commented 6 years ago

My action was working fine but suddenly is infinite looping on askForSignIn.

Here's the block of code I'm using in express:

const ActionsSdkApp = require("actions-on-google").ActionsSdkApp;
router.post("/googleHome", (req, res) => {
    const app = new ActionsSdkApp({ request: req, response: res });

    if (!app.getUser().accessToken) {
        console.log("ask for sign in");
        app.askForSignIn();
    } else {
        console.log("signed in");
        app.tell("signed in");
    }
});

If I run this, I get "ask for sign in" in my console about every second until google home times out. When I take out the app.askForSignIn() and just leave app.tell("signed in"), everything works fine.

I have "fulfillmentApiVersion": 2 in my action.json file and account linking set up on the action. Running "actions-on-google": "^1.10.0". I do not have transactions enabled as this is a response to the main intent. Our action can't be used without account login. Any suggestions? Just baffled as to why this was working fine earlier (it even passed Google's publishing requirements) and it suddenly stopped working.

Canain commented 6 years ago

Closing this since v2 is now the supported version.

Feel free to open another issue if you encounter this in v2.