首页 > 解决方案 > 使用外部提供者登录时增加超时

问题描述

我使用 ASP.NET Core 5 Identity 和 Google 作为外部登录。

登录 Google 后,返回应用程序时出现 500 错误。

在我的应用程序中访问回调 url "/signin-google" 时发生错误。

检查错误详细信息时,它说这是一个 60 秒超时错误。

如何检查真正的错误是什么?我尝试使用以下方法增加超时:

我在我的应用程序启动ConfigureServices方法中尝试过:

  services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
    .AddGoogle("Google", x => {
      x.ClientId = clientId;
      x.ClientSecret = clientSecret;
      x.RemoteAuthenticationTimeout = TimeSpan.FromSeconds(240);
    });

但奇怪的是,我得到了同样的 60 秒超时错误。

标签: asp.net-coreasp.net-core-identityasp.net-core-5.0

解决方案


如何检查真正的错误是什么?我尝试使用以下方法增加超时:

您需要更改时间BackchannelTimeout

参考: https ://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.authentication.remoteauthenticationoptions.backchanneltimeout?view=aspnetcore-5.0


推荐阅读