My institution has a Jupyter server that allows connecting a Snowflake database through "externalbrowser" authentication using the Python Connector for Snowflake. Our institution uses SSO through Azure Active Directory to login to Snowflake.
I found this similar post but it looks like they never found a solution: Snowflake ODBC Connection | xdg-open Missing X server or $DISPLAY
In Python, I connect to Snowflake using the default authenticator:
conn = snowflake.connector.connect(
user=USER,
account=ACCOUNT,
warehouse=WAREHOUSE,
database=DATABASE,
schema=SCHEMA,
authentication="externalbrowser"
)
Which then returns the following message: "Initiating login request with your identity provider. A browser window should have opened for you to complete the login. If you can't see it, check existing browser windows, or your OS settings. Press CTRL+C to abort and try again...Going to open: https://login.microsoftonline.com/.../saml2?SAMLRequest=... to authenticate...We were unable to open a browser window for you, please open the url above manually then paste the URL you are redirected to into the terminal."
I am able to click on the https://login.microsoftonline.com link which then redirects me to a URL that I copy and paste back into Python. The redirected URL begins with localhost.
However, I am unable to connect to our Snowflake database using externalbrowser authentication in R.
myconn <- DBI::dbConnect(odbc::odbc(),
DRIVER="SnowFlakeDSIIDriver",
server="server",
database="database",
schema="schema",
uid="USERNAME",
AUTHENTICATOR="externalbrowser"
)
The above R code returns "Failed to authenticate a user by external browser: 3."
Why doesn't DBI::dbConnect() also populate a https://login.microsoftonline.com link like Python does?