美文网首页STF
STF之SSO认证

STF之SSO认证

作者: 戈壁堂 | 来源:发表于2021-07-07 10:12 被阅读0次

    集成了公司的SSO认证,一直工作正常,临时断电,重启PC后。服务正常启动,但服务时走认证流程时提示——Failed to obtain access token,搜索对应的问题,找到InternalOAuthError: Failed to obtain access token

    InternalOAuthError: Failed to obtain access token
        at Strategy.OAuth2Strategy._createOAuthError (/home/stf/RemoteDeviceNew/node_modules/passport-oauth2/lib/strategy.js:410:17)
        at /home/stf/RemoteDeviceNew/node_modules/passport-oauth2/lib/strategy.js:177:24
        at /home/stf/RemoteDeviceNew/node_modules/oauth/lib/oauth2.js:191:18
        at ClientRequest.<anonymous> (/home/stf/RemoteDeviceNew/node_modules/oauth/lib/oauth2.js:162:5)
        at emitOne (events.js:116:13)
        at ClientRequest.emit (events.js:211:7)
        at TLSSocket.socketErrorListener (_http_client.js:401:9)
        at emitOne (events.js:116:13)
        at TLSSocket.emit (events.js:211:7)
        at emitErrorNT (internal/streams/destroy.js:66:8)
        at _combinedTickCallback (internal/process/next_tick.js:139:11)
        at process._tickCallback (internal/process/next_tick.js:181:9)
    
    

    看起来是相同的问题,直接采用require('https').globalAgent.options.rejectUnauthorized = false;问题依然复现。

    node_modules/passport-oauth2/lib/strategy.js文件中添加debug信息,重启服务后提示——getaddrinfo ENOTFOUND,看起来是无法找到SSO服务器。从STF所在的机器ping此地址(断电重启的原因?)尝试先在/etc/hosts中添加解析地址。搞定~

    Failed to obtain access in======== token:  { Error: getaddrinfo ENOTFOUND sso.test-sso.com sso.test-sso.com:443
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
      errno: 'ENOTFOUND',
      code: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'sso.test-sso.com',
      host: 'sso.test-sso.com',
      port: 443 }
    

    相关文章

      网友评论

        本文标题:STF之SSO认证

        本文链接:https://www.haomeiwen.com/subject/jffsultx.html