Currently, I am using the OAuthPrompt in Microsfot BotBuilder V4 NodeJs SDK. The OAuthPrompt is mainly used for bot authentication with Azure, but after logging in to azure through the bot, I am not able to move to next function in the waterfall dialog until I send another message to the bot. If I send a message after login, then continueDialog() is called, so next function in waterfall dialog is invoked.
How do I automatically move to the next function in the waterfall dialog without sending another message to bot?
/**
* Waterfall step that prompts the user to login if they have not already or their token has expired.
* @param {WaterfallStepContext} step
*/
async oauthPrompt(step: any) {
await step.prompt(OAUTH_PROMPT);
}
/**
* Waterfall step that informs the user that they are logged in and asks
* the user if they would like to see their token via a prompt
* @param {WaterfallStepContext} step
*/
async loginResults(step: any) {
let tokenResponse = step.result;
if (tokenResponse != null) {
await step.context.sendActivity('You are now logged in.');
return await step.prompt(CONFIRM_PROMPT, 'Do you want to view your token?', ['yes', 'no']);
}
// Something went wrong, inform the user they were not logged in
await step.context.sendActivity('Login was not sucessful please try again');
return await step.endDialog();
}
After the oauthPrompt() is called, the login card is displayed in bot. But after that loginResults() function is not automatically invoked until I send another message. Both functions are in same waterfall dialog?
Can anyone tell me how to call loginResults without sending another message to the bot, please?