haskell - YesodAuth Google OAuth2 超时

标签 haskell oauth-2.0 google-oauth yesod

我正在尝试为我的 Yesod 网站设置身份验证和授权 according to the book .

但是,一旦我设置了 Google OAuth2,我就会超时:

HttpExceptionRequest Request {
  host                 = "accounts.google.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("Content-Type","application/x-www-form-urlencoded")]
  path                 = "/o/oauth2/token"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
 ConnectionTimeout

我尝试使用yesod-auth-oauth2 instead ,但我仍然遇到超时错误:

HttpExceptionRequest Request {
  host                 = "www.googleapis.com"
  port                 = 443
  secure               = True
  requestHeaders       = [("Content-Type","application/x-www-form-urlencoded"),("Authorization","<REDACTED>"),("User-Agent","hoauth2"),("Accept","application/json")]
  path                 = "/oauth2/v3/token"
  queryString          = ""
  method               = "POST"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
 ConnectionTimeout

我为网络应用程序启用了 Google+ API 和联系人 API。我现在正在本地运行我的网站,并且我的授权重定向 URI 为

  • http://localhost:3000/auth/page/google/callback
  • http://localhost:3000/auth/page/googleemail2/complete

最佳答案

事实证明,就我的情况而言,这是由于 www.googleapis.com 的 IPv6 地址被 Cisco AnyConnect 套接字过滤器过滤掉了。

例如,在connection中包中,我在 resolve' 函数中使用 Debug.Trace.trace 添加了 addrs 来找出服务器最初尝试连接到IPv6 地址,然后是 IPv4 地址。连接到 IPv4 地址(例如使用 pingtelnet)可以工作,但 IPv6 地址却不能,所以最终这是防火墙问题。

关于haskell - YesodAuth Google OAuth2 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74891941/

相关文章:

.net - Razor 页面中的 Google 身份验证(Blazor 服务器项目)

python - Google Drive API 的刷新 token 何时到期?

haskell - 为什么foldl1'没有推广到Foldable?

spring - Grails Spring Security OAuth2提供者对具有正确承载 token 的资源的请求重定向到登录

asp.net - 在 Web API 中使用 OAuth 进行身份验证

python - 调用GMAIL API时出现间歇性错误- "The caller does not have permission"

haskell - 为什么 ghci 对类型列表和类型族进行脱糖?可以选择性地禁用它吗?

haskell - 合并无限数量的有序无限序列

haskell - 我怎样才能通过 cabal new-test 的测试选项?

google-chrome-extension - 是否可以使用 Chrome App Indentity Api 获取 Id token ?