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

enable google auth via proxy #183

Closed
yosefy opened this issue Feb 18, 2019 · 8 comments
Closed

enable google auth via proxy #183

yosefy opened this issue Feb 18, 2019 · 8 comments

Comments

@yosefy
Copy link

yosefy commented Feb 18, 2019

i think it can't get to google without proxy config

Feb 18 12:27:53 XXX python[31362]: 2019-02-18 12:27:53,088 [script_server.tornado_auth.INFO] Trying to authenticate user
Feb 18 12:28:13 XXX python[31362]: 2019-02-18 12:28:13,110 [script_server.GoogleOauthAuthorizer.ERROR] Failed to load access_token: Timeout while connecting

@bugy
Copy link
Owner

bugy commented Feb 18, 2019

Hi @yosefy, could have a look at this answer please?
https://stackoverflow.com/a/31641300

Basicaly, before starting the script server, could you try to export mentioned environment variables with your proxy config?

@yosefy
Copy link
Author

yosefy commented Feb 18, 2019 via email

@bugy
Copy link
Owner

bugy commented Feb 18, 2019

ok :( Thanks for checking it

@bugy bugy added the feature label Feb 18, 2019
@yosefy
Copy link
Author

yosefy commented Feb 18, 2019

what worked for me on ubuntu 18

apt-get install libssl-dev libcurl4-openssl-dev python-dev
pip install pycurl

add to src/auth/auth_google_oauth.py

####################################
import os
defaults = {}
http_proxy = os.environ.get('http_proxy')
if http_proxy:
if http_proxy[:7] == "http://":
http_proxy = http_proxy[7:]
defaults['proxy_host'], defaults['proxy_port'] = http_proxy.split(":")
defaults['proxy_port'] = int(defaults['proxy_port'])

httpclient.AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient", defaults=defaults)
############################

@bugy
Copy link
Owner

bugy commented Feb 18, 2019

Great thanks for checking it! Will refactor it somehow and add.

A question: did you configure environment variable http_proxy before that? With lowercase?

@yosefy
Copy link
Author

yosefy commented Feb 18, 2019 via email

@bugy
Copy link
Owner

bugy commented Feb 18, 2019

I would prefer to use default python approach with environment variables (as in stackoverflow answer). Just need to adjust code to it.

@bugy
Copy link
Owner

bugy commented Feb 18, 2019

Done. Now any environment variables (https_proxy or http_proxy, all lowercase or all uppercase) can be used.

This feature requires pycurl to be installed

@yosefy could you check please, if the latest version works for you?

@bugy bugy added this to the 1.14 milestone Feb 18, 2019
@bugy bugy closed this as completed May 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants