✅已解决 | 获取token超时

问题描述

登录成功后,好像是获取token超时,跳转失败。请问,callback地址可以是https:本地地址,还是必须是证书的域名?

重现步骤

登录后,必现

附加信息

error dump: GotError[TimeoutError]: Timeout awaiting ‘request’
for 2500 ms at ClientRequest. < anonymous > {
code: ‘ETIMEDOUT’,
host: ‘igloabmhmeik-demo.authing.cn’,
hostname: ‘igloabmhmeik-demo.authing.cn’,
method: ‘POST’,
path: ‘/oidc/token’,
socketPath: undefined,
protocol: ‘https:’,

将超时时间改大一些,10s 左右。callback 地址只要在控制台配过,都可以使用。

我使用的passport,是可以callback的。谢谢!我找找设置超时的地方。
passport.authenticate(“oidc”,
app.all(

    '/auth/callback',

    passport.authenticate(authStrategy, { failureRedirect: '/auth/login' }),

    async (req, res, next) =>

    {

        logger.debug('/auth/callback');

附上详细信息,麻烦看看。修改超时也不对。
server: ERROR Express error handler dump with tracking ID: 0 a4aeff8 - c714 - 44 c9 - 9 a7c - 196 bac59193a, error dump: GotError[TimeoutError]: Timeout awaiting ‘request’
for 2500 ms at ClientRequest. < anonymous > (server / node_modules / got / source / request - as - event - emitter.js: 176: 14) at Object.onceWrapper(node: events: 642: 26) at ClientRequest.emit(node: events: 539: 35) at ClientRequest.origin.emit(server / node_modules / @szmarczak / http - timer / source / index.js: 37: 11) at Immediate.timeoutHandler(server / node_modules / got / source / utils / timed - out.js: 63: 11) at processImmediate(node: internal / timers: 468: 21) {
code: ‘ETIMEDOUT’,
host: ‘igloabmhmeik-demo.authing.cn’,
hostname: ‘igloabmhmeik-demo.authing.cn’,
method: ‘POST’,
path: ‘/oidc/token’,
socketPath: undefined,
protocol: ‘https:’,

我看超时还是 2.5 s,没有修改超时

改了10秒。
server:ERROR Express error handler dump with tracking ID: 0c3dde7d-c01d-4b02-be4c-c3f81e03dd03, error dump: Error: did not find expected authorization request details in session, req.session[“oidc:igloabmhmeik-demo.authing.cn”] is undefined at server/node_modules/openid-client/lib/passport_strategy.js:125:13 at OpenIDConnectStrategy.authenticate (server/node_modules/openid-client/lib/passport_strategy.js:173:5) at attempt (server/node_modules/passport/lib/middleware/authenticate.js:366:16) at authenticate (server/node_modules/passport/lib/middleware/authenticate.js:367:7) at Layer.handle [as handle_request] (server/node_modules/express/lib/router/layer.js:95:5) at next (server/node_modules/express/lib/router/route.js:137:13) at next (server/node_modules/express/lib/router/route.js:131:14) at next (server/node_modules/express/lib/router/route.js:131:14) at next (server/node_modules/express/lib/router/route.js:131:14) at next (server/node_modules/express/lib/router/route.js:131:14) +0ms

改成10秒后,重定向了很多次
passport.authenticate(authStrategy, { failureRedirect: ‘/auth/login’ }),
-server /auth/login +0ms
-server /auth/login +616ms
-server /auth/login +584ms
-server /auth/login +456ms
-server /auth/login +519ms
-server /auth/login +476ms
-server /auth/login +1s
-server /auth/login +2s
-server /auth/login +599ms
-server /auth/login +391ms
-server /auth/login +480ms
-server /auth/login +432ms
-server /auth/login +473ms

请问重定向地址必须有证书的域名吗? 我现在是https://本地ip的方式

这种情况是因为你的业务系统始终认为自己没有登录,没有前后端的会话,跳转到 authing,由于已经登录过,authing 又把浏览器重定向回去了,检查下 passport session 问题吧

重定向地址 authing 不做要求