我有一个 ASP MVC Web 应用程序,它使用 Azure AD 作为用户登录和注销的一种形式。该应用程序已在 Azure AD 中注册,并且登录工作正常。
值得注意的是,我使用 OWIN 界面进行登录和注销。
问题是,当我按下应用程序上的注销按钮时,会执行以下代码:
HttpContext.GetOwinContext().Authentication.SignOut(
OpenIdConnectAuthenticationDefaults.AuthenticationType,
CookieAuthenticationDefaults.AuthenticationType);
此处用户已成功注销,但网页未重定向到登录页面。相反,当从 https://login.windows.net/.../oauth2/logout?post_logout_redirect_uri= 重定向时,它会导致两个 Microsoft 站点之间出现 CORS 错误。 ...到https://login.microsoftonline.com/.../oauth2/logout?post_logout_redirect_uri= ...
CORS 错误为:从 {url 1} 到 {url 2} 的重定向已被 CORS 策略阻止:请求的资源上不存在“Access-Control-Allow-Origin” header 。来源'http://localhost:1089 ' 因此不允许访问。
我有点不知所措,这是否是我的应用程序或 azure 设置中的问题,因为我无法控制此重定向。
最佳答案
关于c# - Azure Active Directory 导致注销时出现 CORS 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41724852/