团队:个人选项卡 => 成功的身份验证重定向回登录页面(由于未设置 cookie)
Teams: Personal Tab => successful authentication redirects back to login page (Due to cookie not being set)
所以我们有这个 Web 应用程序 运行ning,但我们想从中制作一个 Teams 应用程序(个人选项卡)。我们使用 App Studio 来创建应用程序(清单和所有),但是当 运行 从边栏中打开它时,我们将无法通过登录屏幕。成功登录后,您将被重定向回登录页面(一切都发生在同一域中)。
但是,当我们尝试 运行 将“应用程序”作为组中的一个选项卡时,它奏效了。所以我们需要找出为什么当我们 运行 它作为团队“应用程序”时它不起作用。
如有任何想法,我们将不胜感激:)
问题在于,由于它 运行 在 iframe 中(实际上),ASP.NET State 设置的 cookie 需要声明 SameSite="None" 和 Secure="真的。
Applications that use <iframe>
may experience issues with sameSite=Lax or sameSite=Strict cookies because <iframe>
is treated as cross-site scenarios. - https://docs.microsoft.com/en-us/aspnet/samesite/system-web-samesite
所以我不得不将 .NET Target Framework 升级到 4.7.2,并进行本文档中所述的更改:https://docs.microsoft.com/en-us/aspnet/samesite/system-web-samesite
所以我们有这个 Web 应用程序 运行ning,但我们想从中制作一个 Teams 应用程序(个人选项卡)。我们使用 App Studio 来创建应用程序(清单和所有),但是当 运行 从边栏中打开它时,我们将无法通过登录屏幕。成功登录后,您将被重定向回登录页面(一切都发生在同一域中)。
但是,当我们尝试 运行 将“应用程序”作为组中的一个选项卡时,它奏效了。所以我们需要找出为什么当我们 运行 它作为团队“应用程序”时它不起作用。
如有任何想法,我们将不胜感激:)
问题在于,由于它 运行 在 iframe 中(实际上),ASP.NET State 设置的 cookie 需要声明 SameSite="None" 和 Secure="真的。
Applications that use
<iframe>
may experience issues with sameSite=Lax or sameSite=Strict cookies because<iframe>
is treated as cross-site scenarios. - https://docs.microsoft.com/en-us/aspnet/samesite/system-web-samesite
所以我不得不将 .NET Target Framework 升级到 4.7.2,并进行本文档中所述的更改:https://docs.microsoft.com/en-us/aspnet/samesite/system-web-samesite