我在使用 next-auth 登录 google 时遇到了一些问题,在本地一切正常,但在生产中,我有一些错误,我在选择 google 帐户后得到了错误, 这是错误
[next-auth][error][OAUTH_CALLBACK_ERROR]
https://next-auth.js.org/errors#oauth_callback_error JWT expired, now 1679915090, exp 1679893540 {
error: RPError: JWT expired, now 1679915090, exp 1679893540
at Client.validateJWT (/app/node_modules/openid-client/lib/client.js:956:15)
at Client.validateIdToken (/app/node_modules/openid-client/lib/client.js:745:60)
at Client.callback (/app/node_modules/openid-client/lib/client.js:488:18)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async oAuthCallback (/app/node_modules/next-auth/core/lib/oauth/callback.js:109:16)
at async Object.callback (/app/node_modules/next-auth/core/routes/callback.js:52:11)
at async AuthHandler (/app/node_modules/next-auth/core/index.js:201:28)
at async NextAuthHandler (/app/node_modules/next-auth/next/index.js:24:19)
at async /app/node_modules/next-auth/next/index.js:60:32 {
name: 'OAuthCallbackError',
code: undefined
},
providerId: 'google',
message: 'JWT expired, now 1679915090, exp 1679893540'
}
这是我的代码
export default NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET
})
],
secret: process.env.SECRET,
callbackUrl: process.env.CALLBACK_URL,
debug: false,
jwt: {
maxAge: 3 * 24 * 60 * 60,
},
})
我可以无误地使用谷歌登录