-
Notifications
You must be signed in to change notification settings - Fork 516
Description
What is the current behavior?
The bigger context is that I am using gitpod, a cloud IDE, and I want to use externalbrowser
authentication with Snowflake. This opens a SAML flow that always redirects to localhost
, but I want it to redirect to my gitpod instance's URL, where the server is actually listening.
For the port, I can use this SF_AUTH_SOCKET_PORT
variable and that works brilliantly:
- I set
export SF_AUTH_SOCKET_PORT=50000
- It spins up a server at
localhost:50000
- The eventual redirect happens to
localhost:50000
.
However, for the hostname, if I try to set something like export SF_AUTH_SOCKET_ADDR='myworkspace.gitpod.io'
, then it complains that it cannot assign the requested address:
[Errno 99] Cannot assign requested address
I guess socket.bind
doesn't like us passing actual domain names.
snowflake-connector-python/src/snowflake/connector/auth/webbrowser.py
Lines 119 to 123 in 9b6b0a6
socket_connection.bind( | |
( | |
os.getenv("SF_AUTH_SOCKET_ADDR", "localhost"), | |
int(os.getenv("SF_AUTH_SOCKET_PORT", 0)), | |
) |
So I wonder, how should we use this environment variable then?
Is there any way to change the redirect URL to some public URL like myworkspace.gitpod.io
?
What is the desired behavior?
SF_AUTH_SOCKET_ADDR
also modifies the redirect URL instead of leaving it onlocalhost
- We create a new
SF_AUTH_REDIRECT_URL
env variable that controls only the redirect URL for the SAML request
How would this improve snowflake-connector-python
?
Cloud IDE users would be able to use externalbrowser
authentication.
References and other background
snowflake-connector-python/src/snowflake/connector/auth/webbrowser.py
Lines 119 to 123 in 9b6b0a6
socket_connection.bind( | |
( | |
os.getenv("SF_AUTH_SOCKET_ADDR", "localhost"), | |
int(os.getenv("SF_AUTH_SOCKET_PORT", 0)), | |
) |
body["data"]["BROWSER_MODE_REDIRECT_PORT"] = str(callback_port) |