passport-oauth2
passport-oauth2 copied to clipboard
InternalOAuthError swallows exception details
I'm developing a site using passport-oauth2 (awesome!), however, when testing it in k8s I have different URI endpoints for the oauth2 server (internal DNS name); this caused this error:
InternalOAuthError: Failed to obtain access token
at OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:408:17)
at /app/node_modules/passport-oauth2/lib/strategy.js:175:45
at /app/node_modules/oauth/lib/oauth2.js:191:18
at ClientRequest.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:162:5)
at ClientRequest.emit (events.js:193:13)
at TLSSocket.socketErrorListener (_http_client.js:397:9)
at TLSSocket.emit (events.js:193:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
Based on that stacktrace, what happened? It would be much better to concatenate the inner error as the message of the thrown error, rather than forcing the global error handler to reflect properties on the error instance.
So this issue is about that; prefer usability.