-
-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Hi,
Thank you for the amazing plugin! Managed to get it working nicely without much effort.
One thing I ran into is that the sasl-xoauth2-tool
always uses 127.0.0.1 as the redirect host and the port is randomized. Would it be possible to make the below things configurable?
- IP to bind the HTTP server to
- Port to have the HTTP server listen on
- HTTP host for the callback URL
- HTTP port for the callback URL
If these 4 things are configurable via a simple environment variable (or by passing a parameter to the script), it greatly simplifies putting this in a Docker container. Point 1 is to be able to listen on 0.0.0.0 in a Docker container, point 2 is to allow for a fixed port to be able to use docker port mappings, and points 3 and 4 are to be able to set the proper host/port of either a reverse proxy or the machine the container is running on.
Only an idea though. I managed to make an easy workaround by creating a Python script that starts sasl-xoauth2-tool
, asks for the URL you were redirected back to, and then calls that URL from the script.
Related code:
sasl-xoauth2/scripts/sasl-xoauth2-tool.in
Lines 50 to 59 in 41b27db
def gmail_redirect_uri(local_port:int) -> str: | |
return 'http://127.0.0.1:%d%s' % (local_port, GOOGLE_OAUTH2_RESULT_PATH) | |
def gmail_get_auth_url(client_id:str, scope:str, local_port:int) -> str: | |
client_id = url_safe_escape(client_id) | |
scope = url_safe_escape(scope) | |
redirect_uri = url_safe_escape(gmail_redirect_uri(local_port)) | |
return '{}?client_id={}&scope={}&response_type={}&redirect_uri={}'.format( | |
GOOGLE_OAUTH2_AUTH_URL, client_id, scope, 'code', redirect_uri) |