Skip to content

SNOW-974917: How can we use SF_AUTH_SOCKET_ADDR ?Β #1811

@RobbertDM

Description

@RobbertDM

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.

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 on localhost
  • 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

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)

Metadata

Metadata

Labels

featurestatus-in_progressIssue is worked on by the driver teamstatus-triage_doneInitial triage done, will be further handled by the driver teamtriaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions