Skip to main content

Enable Snowflake OAuth

Follow this guide to enable Snowflake OAuth integration in DataChat.

Step 1: Create Snowflake OAuth Integration

Run the following SQL script in your Snowflake database to create the OAuth integration:

CREATE SECURITY INTEGRATION DATACHAT_OAUTH_INTEGRATION
TYPE = OAUTH
ENABLED = TRUE
OAUTH_CLIENT = CUSTOM
OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
OAUTH_REDIRECT_URI = 'http://apps.datachat.ai'
OAUTH_ISSUE_REFRESH_TOKENS = TRUE
OAUTH_ALLOW_NON_TLS_REDIRECT_URI = TRUE

Step 2: Retrieve Your Snowflake Account Name

You can obtain you SNowflake account name using one of these methods:

Method 1: Check the Browser URL

  1. Log in to your Snowflake account.
  2. Look at the URL in your browser’s address bar. The format will be: https://<account_name>.<region>.snowflakecomputing.com/
  3. Your account name is <account_name>.<region>. Example: xy12345.us-east-2

Method 2: Run SQL Queries

Run the following SQL queries in Snowflake to retrieve the required information:

  • To get the account name:

    SELECT CURRENT_ACCOUNT() AS account_name;
  • To get the region:

    SELECT CURRENT_REGION() AS region;

Important Notes

  • The account name is case-sensitive. Use it exactly as it appears.
  • Always include the region (e.g., us-east-2) as part of the account name. Format: <account_name>.<region>
  • The correct account name format is essential for constructing the OAuth token endpoint URL and ensuring you're connected to the correct Snowflake account.

Step 3: Get Client Secret and Client ID

Retrieve the Client Secret and Client ID for the integration by running the following queries in Snowflake:

  • To describe the integration:

    DESCRIBE INTEGRATION "DATACHAT_OAUTH_INTEGRATION_DEV";
  • To retrieve the Client Secret:

    SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('DATACHAT_OAUTH_INTEGRATION_DEV');

Step 4: Share Required Information

Once you have gathered your account ID, client ID, and client secret, contact your DataChat administrator to share this information and complete the integration setup.