Skip to content

sasl-xoauth2-tool option for reverse proxy HTTP host/port and local port #82

@SunMar

Description

@SunMar

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?

  1. IP to bind the HTTP server to
  2. Port to have the HTTP server listen on
  3. HTTP host for the callback URL
  4. 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:

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions