Reputation: 23
I am using OAuth Authorisation Flow for my google action and for some reason, it is asking for parameters then initiating account linking and then asking for parameters again.
app.intent('Create Channel Intent', async (conv, params) => {
if (!conv.user.access.token) {
conv.ask(new SignIn());
} else {
var locale = conv.user.locale;
if (locale === 'hi-IN') {
var accessToken = conv.user.access.token;
var channelNameRaw = params.channelname;
var channelNameData = await helperFunctions.hinditranslate(channelNameRaw);
var channelNameLwr = channelNameData.toLowerCase();
var channelName = helperFunctions.replaceWhitespacesFunc(channelNameLwr);
const headers = await helperFunctions.login(accessToken);
const speechText = await helperFunctions.createChannel(channelName, headers);
conv.ask(speechText);
} else {
var accessToken = conv.user.access.token;
var channelNameRaw = params.channelname;
var channelNameData = channelNameRaw.toLowerCase();
var channelName = helperFunctions.replaceWhitespacesFunc(channelNameData);
const headers = await helperFunctions.login(accessToken);
const speechText = await helperFunctions.createChannel(channelName, headers);
conv.ask(speechText);
}
}
});
Upvotes: 0
Views: 81
Reputation: 11
I am %99 sure that your intent's sloth filling is off.
Your Create Channel Intent has channelname as required parameter. Without Sloth-filling, intents won't call your server/code until every required parameter is fulfilled.
What happening is:
To fix do one of this:
Hope it helps.
Upvotes: 1
Reputation: 590
You shouldn't add training phrase to your SignIn event intent. If the intent which asks for signin permission has training phares would be enough. Because it directs to actions_intent_SIGN_IN event and continues on there unless user didn't signed in yet. I guess you made these two action in one intent so this makes it confused and tries to call same intent and asks for parameters.
If you had to use this way try to use context so you can pass parameter values to this intent on second call.
Upvotes: 1