> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Snowflake with OAuth 2.0 (Your Own App) – StackOne Hub

> Link a Snowflake account in the StackOne Hub using OAuth 2.0 (Your Own App). End-user guide to authorize the integration and start using Snowflake actions.

> [!WARNING]
>
> ACCOUNTADMIN role (or a role with the global CREATE INTEGRATION privilege) is required to create the OAuth security integration. Note: ACCOUNTADMIN, SECURITYADMIN, ORGADMIN, and GLOBALORGADMIN are blocked from OAuth by default and cannot be used as the Snowflake Role.

## Create an OAuth security integration

A custom OAuth security integration registers StackOne as an OAuth client in your Snowflake account and pre-authorizes the role your users will connect with.

**1. Create the security integration**

Sign in to your [Snowflake account](https://app.snowflake.com) and open **Projects** > **Workspaces** > **+ Add new** to create a new SQL worksheet.\
\
Run the following SQL, replacing `<integration_name>` with a name of your choice (e.g., `STACKONE_OAUTH`), `<callback_url>` with the **Callback URL** from your Connector Profile, and `<role_name>` with the Snowflake role your users will authorize with.

```sql theme={null}
CREATE SECURITY INTEGRATION <integration_name>
  TYPE = OAUTH
  OAUTH_CLIENT = CUSTOM
  OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
  OAUTH_REDIRECT_URI = '<callback_url>'
  ENABLED = TRUE
  OAUTH_ISSUE_REFRESH_TOKENS = TRUE
  OAUTH_REFRESH_TOKEN_VALIDITY = 7776000
  PRE_AUTHORIZED_ROLES_LIST = ('<role_name>');
```

<ul>
  <li>`OAUTH_REFRESH_TOKEN_VALIDITY` is in seconds — 7776000 equals 90 days</li>
  <li>The role in `PRE_AUTHORIZED_ROLES_LIST` must exactly match the **Snowflake Role** field.</li>
  <li>Example: if your users connect with the `SYSADMIN` role, use `PRE_AUTHORIZED_ROLES_LIST = ('SYSADMIN')` and enter `SYSADMIN` as the **Snowflake Role**</li>
  <li>To find a role: your current role is shown next to your username in the bottom-left corner of Snowsight (e.g., `ACCOUNTADMIN`). Note that ACCOUNTADMIN, SECURITYADMIN, ORGADMIN, and GLOBALORGADMIN are blocked for OAuth — pick a non-blocked role such as `SYSADMIN`</li>
</ul>

**2. Retrieve the client credentials**

Snowflake generates the client credentials when the integration is created, and they are retrieved with a system function rather than shown in the UI.\
\
In the same worksheet, run the following SQL, replacing `<INTEGRATION_NAME>` with your integration name in uppercase, wrapped in single quotes.

```sql theme={null}
SELECT SYSTEM$SHOW_OAUTH_CLIENT_SECRETS('<INTEGRATION_NAME>');
```

**3. Copy your credentials**

The result is a JSON object containing your client credentials. Copy them across.

<ul>
  <li>`oauth_client_id` is your **OAuth Client ID**</li>
  <li>`oauth_client_secret` is your **OAuth Client Secret**</li>
</ul>

## Find your account identifier

Your account identifier uniquely identifies your Snowflake account and routes API requests to it.

**1. Copy the Account Identifier**

Sign in to your [Snowflake account](https://app.snowflake.com) and click your **user profile** (showing your username and role) in the bottom-left corner of the sidebar.

<ul>
  <li>In the menu that opens, click your account entry (e.g., **Account: AB12345**) to expand the account submenu.</li>
  <li>Select **View account details**.</li>
  <li>Copy the **Account Identifier** shown in the dialog.</li>
  <li>Format: `orgname-accountname` (e.g., `myorg-account123`)</li>
  <li>Alternative — run `SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME();` in any worksheet</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.