private static async Task<DialogTurnResult> LoginStepAsync(WaterfallStepContext step, CancellationToken cancellationToken)
{
// Get the token from the previous step. Note that we could also have gotten the
// token directly from the prompt itself. There is an example of this in the next method.
var tokenResponse = (TokenResponse)step.Result;
if (tokenResponse != null)
{
// use the token to do exciting things!
}
else
{
// If Bot Service does not have a token, send an OAuth card to sign in
}
await step.Context.SendActivityAsync("Login was not successful please try again.", cancellationToken: cancellationToken);
return Dialog.EndOfTurn;
}
1 回答
我知道这是一个迟到的答案,但它可能有助于某人 . 您需要在Azure中创建机器人服务并获取Microsoft App Id和App Password . 然后,您可以提示用户登录 .
创建
WaterfallStep
以登录Prompt
.接下来,您可以继续使用令牌执行任何操作 .
请按照this指南获取更多信息 .
您甚至可以像Github,Facebook一样为Azure设置其他OAuth提供程序 . 要执行此操作,请转到Bot Channels Registration的设置,然后找到添加新连接选项 .