Reputation: 41
I am trying account linking for my actions on google using oauth. For the authorization and token url I used auth0 . I am using the Sign in event in my default welcome event but am encountered with an error and it doesn't take me to the sign in page.
Code:
const functions = require('firebase-functions');
const {dialogflow, BasicCard , Image , Button , Suggestions , SignIn} = require( 'actions-on-google');
const app = dialogflow( {
clientId : 'xxxxxxxxxxxxxxxx.apps.googleusercontent.com',
debug : true,
});
});
app.intent('Default Welcome Intent', (conv) =>{
conv.ask(new SignIn("Hello! Welcome"));
})
app.intent("Get Signin",(conv , params, signin) =>{
if(signin.status === 'OK'){
const name = conv.user.name
conv.ask(`Hello ${name}. What can I do for you?`)
conv.ask(new Suggestions(['About'],['Send'],['Receive'],['Check'],['Cancel']));
}
else
{
conv.close("Please sign in to view actions");
}
})
Upvotes: 1
Views: 245
Reputation: 3241
You have created a loop in your intents by adding the Google SignIn Event to your default welcome intent. In your code you have added the sign-in logic to the handler for the Get Signin intent. Please create an intent named Get Signin and add the Google Signin Event there.
This should fix your issue because, right now any user that sign-ins is redirected to your welcome intent and the code of the Default Welcome Intent. This doesn't know how to handle signin events. It just tries to sign-in the user again.
Upvotes: 1