passport-oauth2 icon indicating copy to clipboard operation
passport-oauth2 copied to clipboard

v1.5+ Breaks OAuth2Strategy callback

Open Number16BusShelter opened this issue 3 years ago • 3 comments

After upgrading all modules I found out that OAuth2Strategy callback just did't fire.

I've created this issue at StackOverflow

After downgrading to 1.5.0 from 1.6.1 the problem is completely gone.

Please, provide some more info on this problem and how to resolve it.

Regards

Number16BusShelter avatar Feb 01 '22 19:02 Number16BusShelter

@Number16BusShelter I had a similar issue. I've tried downgrading to 1.5.0 like you suggest but that didn't help. Found this https://github.com/nodejs/node/issues/42116 issue in the node repo, downgraded to 16.3.0 and it worked like a charm without any errors. I'm using ESM and apparently they broke something in 16.4+. Of course, downgrading node is not the best option, I'll investigate further when I have time.

iohansson avatar Feb 27 '22 20:02 iohansson

I had a similar problem this week after upgrading to node v18, where this strategy stopped working. I spent a few hours until I tried v16 and the authentication start working again.

The error is the following:

InternalOAuthError: Failed to obtain access token
    at OAuth2Strategy._createOAuthError (/mnt/Shared/Code/my-project/api/node_modules/passport-oauth2/lib/strategy.js:423:17)
    at /mnt/Shared/Code/my-project/api/node_modules/passport-oauth2/lib/strategy.js:177:45
    at /mnt/Shared/Code/my-project/api/node_modules/oauth/lib/oauth2.js:191:18
    at ClientRequest.<anonymous> (/mnt/Shared/Code/my-project/api/node_modules/oauth/lib/oauth2.js:162:5)
    at ClientRequest.emit (node:events:537:28)
    at ClientRequest.emit (node:domain:482:12)
    at Socket.socketErrorListener (node:_http_client:465:9)
    at Socket.emit (node:events:537:28)
    at Socket.emit (node:domain:482:12)
    at emitErrorNT (node:internal/streams/destroy:151:8) {
  oauthError: Error: connect ECONNREFUSED ::1:8000
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1237:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '::1',
    port: 8000
  }
}

At http://localhost:8000 was the oauth2 server (Laravel Passport).

lcdss avatar Jul 21 '22 00:07 lcdss

Hi, i have the same problem, i use v16.14.0 and the oauth library with 0.9.15. Is the problem also related to the version or are there any update and would a downgrade of the version help?

hdmr25 avatar Aug 22 '22 15:08 hdmr25