本文介绍了使用MS Teams作为渠道:“身份验证对话框"(Microsoft.Bot.Builder.Dialogs中的GetTokenDialog类)不会弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何与MS Teams一起使用Bot Builder中的新身份验证功能?

How can I use the new authentification feature in Bot Builder with MS Teams?

Teams似乎有问题(请参见使用MS Teams bot登录用户 https://github.com/Microsoft/BotBuilder/issues/2104),似乎是否在GetTokenDialog中不考虑这一点?

There seems to be an issue with Teams (see Login user with MS Teams bot or https://github.com/Microsoft/BotBuilder/issues/2104), seems if this is not considered in GetTokenDialog?

有没有机会解决这个问题?

Is there any chance to get around this?

推荐答案

要使其正常工作,您需要做一些事情.首先,您需要在团队中为机器人创建清单文件,并将白名单token.botframework.com列入白名单.那是第一个问题.

There are a few things you need to do to get this to work. First you need to create a manifest file for your bot in teams and whitelist token.botframework.com. That is the first problem.

从AppStudio中的团队本身创建清单.我不得不玩一点.在AppDetails中...让它生成一个新的ID.只需按一下按钮.网址对于测试确实无关紧要.程序包名称只需唯一即可,例如com.ilonatag.teams.test

From teams itself in AppStudio you create a Manifest. I had to play around with this a little bit. In AppDetails... Let it generate a new ID. Just hit the button. The URLs really don't matter much for testing. The package name just needs to be unique so something like com.ilonatag.teams.test

在机器人"部分中,插入MS AppId和一个机器人名称.这是代码中来自web.config的机器人MicrosoftAppId"value ="中的真实MSAPPID.

In the bots section you plug in your MS AppId and a bot name. This is a the real MSAPPID from your bots MicrosoftAppId" value=" from web.config in your code.

好吧,现在在完成->有效域"中,我添加了token.botframework.com以及我的机器人的URL,以防万一.所以像franktest.azurewebsites.net

Ok now in "finish->valid domains" I added token.botframework.com and also the URL for my bot just in case. so something like franktest.azurewebsites.net

这部分已经完成,但是您还没有完成...在您的消息控制器中,您需要添加此内容,因为Teams发送的验证不同于其他客户端.

This part is done but you are not quite done... in your messages controller you need to add this since Teams sends a different verification than the other clients.

if (message.Type == ActivityTypes.Invoke)
{
                // Send teams Invoke along to the Dialog stack
                if (message.IsTeamsVerificationInvoke())
                {
                    await Conversation.SendAsync(message, () => new Dialogs.RootDialog());
                }
}

我花了很多时间与Microsoft进行反复交流才能弄清楚这一点.

It took me a bunch of going back and forth with Microsoft to get this sorted out.

这篇关于使用MS Teams作为渠道:“身份验证对话框"(Microsoft.Bot.Builder.Dialogs中的GetTokenDialog类)不会弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 21:15