Anyway to set proxy setting in passportjs?

Viewed 5170

Currently, I am using sails framework which is based on expressjs and using passportjs(http://passportjs.org/) to do yammer authentication.

I have problem when deploying my node app on server which is behind the company proxy. It cannot connect to yammer for OAuth2 authentication.

The error is as follow:

error: failed to obtain access token (Error: connect ETIMEDOUT)
    at /root/rlps/node_modules/passport-yammer/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:125:38
    at /root/rlps/node_modules/passport-yammer/lib/passport-yammer/strategy.js:72:20
    at ClientRequest. (/root/rlps/node_modules/passport-yammer/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:129:5)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at CleartextStream.socketErrorListener (http.js:1547:9)
    at CleartextStream.EventEmitter.emit (events.js:95:17)
    at Socket.onerror (tls.js:1437:17)
    at Socket.EventEmitter.emit (events.js:117:20)
    at net.js:441:14
    at process._tickDomainCallback (node.js:459:13)

I believe it is because the proxy is blocking the way. I tried to set everything in environment value (like http_proxy and https_proxy) but seems the code does not acknowledge them and need to config it in somewhere in passportjs instead.

So, any good way to set proxy setting in passportjs or solve this proxy issue in nodejs?

1 Answers
Related