Google OAuth登录不再有效



我的生产Web应用程序与谷歌的合作一直很好,用户登录时使用"使用谷歌登录";按钮昨天它因为某种奇怪的原因停止了工作。用户可以输入他们的Google OAuth凭据,但没有重定向回我的网站,并且在1分钟后超时,出现取消异常。我的开发机器工作得很好,所以这让我觉得我的IP/域在某种程度上被谷歌列入了黑名单。如何解决此问题?在谷歌开发人员控制台中,情况看起来很好,没有改变。

这是我得到的例外:

Category: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
EventId: 1
RequestId: 800003a6-0000-fb00-b63f-84710c7967bb
RequestPath: /signin-google
SpanId: |1ef968c6-4314b979fec6a574.
TraceId: 1ef968c6-4314b979fec6a574
ParentId: 
An unhandled exception has occurred while executing the request.
Exception: 
System.Exception: An error was encountered while handling the remote login.
---> System.Threading.Tasks.TaskCanceledException: The operation was canceled.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler`1.ExchangeCodeAsync(OAuthCodeExchangeContext context)
at Microsoft.AspNetCore.Authentication.OAuth.OAuthHandler`1.HandleRemoteAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

我发现,对于谷歌的OAuth,在他们需要在谷歌开发控制台上批准所有范围之前,你只能登录100次。这适用于您的真实域,而不是在localhost上开发,因为localhost总是有效的。

当我达到100时没有错误消息,只有1分钟后的超时。一旦谷歌批准了我的网站,一切又恢复了正常。

最新更新