jaredhanson / passport-openidconnect

OpenID Connect authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-openidconnect/?utm_source=github&utm_medium=referral&utm_campaign=passport-openidconnect&utm_content=about
MIT License
188 stars 173 forks source link

Proxy issue - Is it possible to expose the _oauth2 property, similar to the passport-oauth2 strategy? #74

Open piyushsmantri opened 4 years ago

piyushsmantri commented 4 years ago

I am trying to perform openid authentication behind a corporate proxy, and for that, I need to set the proxy options for the agent, similar to the following:

var HttpsProxyAgent = require('https-proxy-agent');
if (process.env['https_proxy']) {
 var httpsProxyAgent = new HttpsProxyAgent(process.env['https_proxy']);
 strategy._oauth2.setAgent(httpsProxyAgent);
}
passport.use(strategy);

I cannot perform this unless the ._oauth2 property is exposed. Or is there any other way to configure the proxy options?

pateldd1 commented 4 years ago

Git clone the whole repo and import it instead of the npm package. In lib/strategy.js on line 414 do this from your code


 const oauth2Client = new OAuth2(config.clientID, config.clientSecret,
                    '', config.authorizationURL, config.tokenURL);
            oauth2Client.setAgent(httpsProxyAgent)
            return oauth2Client
}```