snowflakedb / SnowAlert

Security Analytics Using The Snowflake Data Warehouse
Apache License 2.0
184 stars 57 forks source link

Support oauth for snowflake deployments in non-default regions #464

Closed asproul closed 4 years ago

asproul commented 4 years ago

Construct the snowflake hostname i.e. {account}.snowflakecomputing.com or {account}.{region}.snowflakecomputing.com following the snowflake documentation for multiple regions. Inspired by https://github.com/snowflakedb/snowflake-connector-python/blob/e2d835d6e574e7e1856e60e703d9b5f8826e369a/src/snowflake/connector/connection.py#L686-L688

Supplying the region to connect_db allows one to connect to the region specific endpoint for snowflake. Tested this change by building and running the web-ui docker image, I was able to login using oauth to the SnowAlert web ui to my snowflake account located in us-east-1.

Before these changes, I was not able to login using oauth as the web ui was hitting the default region endpoint (mydemo.snowflakecomputing.com) rather than (mydemo.us-east-1.snowflakecomputing.com).