next-auth with googleProvider 返回错误:超时 // 尝试使用其他帐户登录

Jun*_* Oh 5 firewall google-signin next-auth

您好,我正在使用 next.js 和 next-auth googleProvider 进行工作。我已经在本地环境中完成了编码,现在正在生产中进行测试。

我面临的问题是,当尝试登录时,Google API 返回错误。症状如下

  • 它打印“尝试使用其他帐户登录。” 在浏览器中
  • 它在服务器中返回如下错误消息
>>>> redirect callback /welcome http://test.abc.com:5000
[next-auth][error][GET_AUTHORIZATION_URL_ERROR]
https://next-auth.js.org/errors#get_authorization_url_error connect ETIMEDOUT 172.217.26.237:443 {
  message: 'connect ETIMEDOUT 172.217.26.237:443',
  stack: 'Error: connect ETIMEDOUT 172.217.26.237:443\n' +
    '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)',
  name: 'Error'
}
[next-auth][error][SIGNIN_OAUTH_ERROR]
https://next-auth.js.org/errors#signin_oauth_error connect ETIMEDOUT 172.217.26.237:443 {
  error: {
    message: 'connect ETIMEDOUT 172.217.26.237:443',
    stack: 'Error: connect ETIMEDOUT 172.217.26.237:443\n' +
      '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)',
    name: 'Error'
  },
  provider: {
    id: 'google',
    name: 'Google',
    type: 'oauth',
    wellKnown: 'https://accounts.google.com/.well-known/openid-configuration',
    authorization: { params: [Object] },
    idToken: true,
    checks: [ 'pkce', 'state' ],
    profile: [Function: profile],
    clientId: 'private.info.apps.googleusercontent.com',
    clientSecret: 'user_secret',
    httpOptions: { timeout: 6000000, agent: false },
    signinUrl: 'http://test.abc.com:5000/api/auth/signin/google',
    callbackUrl: 'http://test.abc.com:5000/api/auth/callback/google'
  },
  message: 'connect ETIMEDOUT 172.217.26.237:443'
}
Run Code Online (Sandbox Code Playgroud)

所以...首先,我猜这是一个防火墙问题。不过我可以从谷歌端点接收数据。(即curl https://accounts.google.com/.well-known/openid-configuration)

我也能够 fetch curl 172.217.26.237:443,但它返回零字节。

下面是我的[...nextAuth.js]。(我认为没什么特别的)

>>>> redirect callback /welcome http://test.abc.com:5000
[next-auth][error][GET_AUTHORIZATION_URL_ERROR]
https://next-auth.js.org/errors#get_authorization_url_error connect ETIMEDOUT 172.217.26.237:443 {
  message: 'connect ETIMEDOUT 172.217.26.237:443',
  stack: 'Error: connect ETIMEDOUT 172.217.26.237:443\n' +
    '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)',
  name: 'Error'
}
[next-auth][error][SIGNIN_OAUTH_ERROR]
https://next-auth.js.org/errors#signin_oauth_error connect ETIMEDOUT 172.217.26.237:443 {
  error: {
    message: 'connect ETIMEDOUT 172.217.26.237:443',
    stack: 'Error: connect ETIMEDOUT 172.217.26.237:443\n' +
      '    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)',
    name: 'Error'
  },
  provider: {
    id: 'google',
    name: 'Google',
    type: 'oauth',
    wellKnown: 'https://accounts.google.com/.well-known/openid-configuration',
    authorization: { params: [Object] },
    idToken: true,
    checks: [ 'pkce', 'state' ],
    profile: [Function: profile],
    clientId: 'private.info.apps.googleusercontent.com',
    clientSecret: 'user_secret',
    httpOptions: { timeout: 6000000, agent: false },
    signinUrl: 'http://test.abc.com:5000/api/auth/signin/google',
    callbackUrl: 'http://test.abc.com:5000/api/auth/callback/google'
  },
  message: 'connect ETIMEDOUT 172.217.26.237:443'
}
Run Code Online (Sandbox Code Playgroud)

这是问题所在。

会不会是防火墙问题?- 我只是不明白,因为我可以使用curl.

如果没有,我现在可以尝试哪些事情?谢谢