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.
Create the security integration
Sign in to your Snowflake account 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.
OAUTH_REFRESH_TOKEN_VALIDITYis in seconds — 7776000 equals 90 days- The role in
PRE_AUTHORIZED_ROLES_LISTmust exactly match the Snowflake Role field. - Example: if your users connect with the
SYSADMINrole, usePRE_AUTHORIZED_ROLES_LIST = ('SYSADMIN')and enterSYSADMINas the Snowflake Role - 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 asSYSADMIN
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.
Copy your credentials
The result is a JSON object containing your client credentials. Copy them across.
oauth_client_idis your OAuth Client IDoauth_client_secretis your OAuth Client Secret
Find your account identifier
Your account identifier uniquely identifies your Snowflake account and routes API requests to it.
Copy the Account Identifier
Sign in to your Snowflake account and click your user profile (showing your username and role) in the bottom-left corner of the sidebar.
- In the menu that opens, click your account entry (e.g., Account: AB12345) to expand the account submenu.
- Select View account details.
- Copy the Account Identifier shown in the dialog.
- Format:
orgname-accountname(e.g.,myorg-account123) - Alternative — run
SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME();in any worksheet
Link the Account
Connect
- Click Connect.
- If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider’s authorization flow.
- Once authorization is successful, you will see a confirmation popup.
Use Actions