我正在为Microsoft Teams创建一个标签,并使用@azure/msal-browser
中的loginPopup进行身份验证。在网络/浏览器应用程序中工作正常,但我在桌面应用程序中安装了该标签,但该标签不起作用,并引发了以下错误:
at EventEmitter.ipcRenderer.sendSync (<anonymous>:1840:18)
at Object.exports.invokeSync (<anonymous>:1814:41)
at Object.<anonymous> (<anonymous>:3360:22)
at Object.require.35../../common/atom-binding-setup (<anonymous>:3513:4)
at o (<anonymous>:2:273)
at r (<anonymous>:2:439)
at <anonymous>:2:468
at Function.PopupHandler.openSizedPopup (index.es.js:10451)
at PublicClientApplication.ClientApplication.acquireTokenPopup (index.es.js:11102)
at PublicClientApplication.loginPopup (index.es.js:12022)
不知道有关msal库的信息还是有关桌面应用程序的电子包装的信息。在此方面的一些指导将不胜感激。
答案 0 :(得分:2)
对于团队标签,请勿使用基于浏览器的身份验证,因为您的标签将需要在浏览器中运行,而且还需要在Windows / Mac OS / linux / iOS和Android中运行。
相反,请查看“团队标签”身份验证的文档,或者, 更好的AAD单一登录
https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-flow-tab
https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/authentication/auth-aad-sso
答案 1 :(得分:1)
LoginPopup无法正常工作,因为Teams公开了它自己的身份验证弹出式窗口,以提供集成MSAL或类似功能的能力,因此最终您需要在弹出式窗口 中进行登录,您可以通过{ {1}}。这是为了正确处理桌面,Web和移动设备方案。
当然,最好的起点是使用文档,例如here和here和here,但不幸的是,这些文档仍然主要引用了已被弃用的ADAL MSAL。因此,作为替代方案,建议您查看最近的PnP sample for MSAL authentication。我目前正在为此PnP存储库制作SSO示例-它仍在进行中,尤其是文档尚不完善,但是您可以看到有效的dotnet示例here。