node-oauth
node-oauth copied to clipboard
How to set proxy in node-auth
I would like to add httpsProxyAgent to node-auth. Does the current implementation has option to add agent option to node-oauth.
This is what I would need...
var HttpsProxyAgent = require('https-proxy-agent');
if (process.env['https_proxy']) {
httpsProxyAgent = new HttpsProxyAgent(process.env['https_proxy']);
}
Finally, set the httpsProxyAgent to the request options right before _executeRequest gets called like this:
options.agent = httpsProxyAgent
I wanted to add proxy details at https://github.com/ciaranj/node-oauth/blob/master/lib/oauth2.js#L110
How can I pass these details. example:
options.proxyhost = 'xyz',
options.proxyport = 1234
options.agent = httpsProxyAgent
How about using setAgent()
?
var HttpsProxyAgent = require('https-proxy-agent');
var oauth2 = new OAuth2(...);
if (process.env['https_proxy']) {
var httpsProxyAgent = new HttpsProxyAgent(process.env['https_proxy']);
oauth2.setAgent(httpsProxyAgent);
}