Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy issue on OAuth2 - ENETUNREACH failed to obtain access token #97

Open
rajasekar-mu opened this issue Aug 11, 2022 · 2 comments
Open

Comments

@rajasekar-mu
Copy link

I have added below proxy options referred at - #jaredhanson/passport-oauth2#59

const agent = new HttpsProxyAgent(process.env.HTTP_PROXY); gStrategy._oauth2.setAgent(agent); passport.use(gStrategy);

but its not working, so directly added proxy on node_modules/oauth/lib/oauth2.js for workaround.

var queryStr= querystring.stringify(parsedUrl.query);
if( queryStr ) queryStr= "?" + queryStr;
httpsProxyAgent = new HttpsProxyAgent(process.env.HTTP_PROXY)
var options = {
host:parsedUrl.hostname,
port: parsedUrl.port,
path: parsedUrl.pathname + queryStr,
method: method,
headers: realHeaders
};
options.agent = httpsProxyAgent;
this._executeRequest( http_library, options, post_body, callback );
}

Any permanent fix is available? Every time we cant change the node_modules inside the Docker container. Kindly provide fixes.

@david114
Copy link

david114 commented Oct 5, 2022

have you found a solution to this problem?

@rajasekar-mu
Copy link
Author

rajasekar-mu commented Oct 8, 2022

Not get permanent fix, still using workaround method

Add additional (Proxy) options request generation in below path,

node_modules/oauth/lib/oauth2.js

httpsProxyAgent = new HttpsProxyAgent(process.env.HTTP_PROXY)
options.agent = httpsProxyAgent;
this._executeRequest( http_library, options, post_body, callback );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants