外部登录在iframe中失败

时间:2019-01-07 12:23:03

标签: c# iframe asp.net-core identityserver4

我有一个带有联合身份验证网关外部登录提供程序的身份服务器4项目。除非将应用程序嵌入到iframe中,否则登录工作正常。如果您多次刷新页面,它将最终起作用。我已将此问题归结为这一行。结果读取cookie会出现问题。成功返回false。

 // read external identity from the temporary cookie
 var result = await HttpContext.AuthenticateAsync(IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme);
 if (result?.Succeeded != true)
    {
    _logger.LogWarning(LoggingEvents.externalerror, "login failed [Failure message: {result.Failure?.Message}] [Failture data: {result?.Failure?.Data}]", result?.Failure?.Message, result?.Failure?.Data);
     throw new Exception("Login failed.");
      }

不幸的是,两个结果?失败?消息和结果?失败?数据都为空,所以我无法得知错误是什么。

为什么外部登录仅在iframe中失败,该如何解决?

0 个答案:

没有答案
相关问题