Skip to main content

OAuth Integration

🔑 What is OAuth?​

OAuth (Open Authorization) is an industry-standard protocol that allows users to grant access to their data or apps without sharing passwords. Snowflake supports OAuth 2.0 to authenticate and authorize access to Snowflake resources.


🎯 Why Integrate OAuth with Snowflake?​

✔️ Delegated access: Apps/users don’t share Snowflake credentials. ✔️ Fine-grained access control: Scopes and roles can be defined for tokens. ✔️ Single sign-on (SSO) experiences for users. ✔️ Compliance and security alignment with modern identity standards.


⚙️ OAuth Integration in Snowflake: How it Works​

🔹 Snowflake acts as an OAuth Resource Server (API/Database). 🔹 A third-party OAuth authorization server (like Okta, Azure AD, Google) issues tokens. 🔹 Clients (apps, BI tools) present the token to Snowflake to access resources.


Key Roles​

ComponentRole
OAuth Authorization ServerIssues access tokens (Okta, Azure AD, etc.).
ClientApp or BI tool needing access.
SnowflakeResource server verifying token and granting access.

OAuth Flow Summary​

1️⃣ User authenticates with the OAuth server (e.g., Google/Okta). 2️⃣ OAuth server issues an access token to the client. 3️⃣ Client sends the token to Snowflake for API/database access. 4️⃣ Snowflake validates the token with the OAuth server (or introspection endpoint). 5️⃣ If valid, Snowflake grants access per the assigned roles/scopes.


Setting Up OAuth Integration in Snowflake​

Here’s a step-by-step approach:

1️⃣ Register Snowflake with the OAuth Provider​

  • ✅ Register your Snowflake account as a client app with the OAuth authorization server (like Okta).
  • ✅ Configure redirect URIs (e.g., for BI tools).

2️⃣ Create an External OAuth Integration in Snowflake​

CREATE SECURITY INTEGRATION my_oauth_integration
TYPE = OAUTH
ENABLED = TRUE
OAUTH_CLIENT = EXTERNAL
OAUTH_CLIENT_TYPE = 'CONFIDENTIAL' -- (or PUBLIC)
OAUTH_ISSUE_REFRESH_TOKENS = TRUE -- optional
OAUTH_REDIRECT_URI = '<redirect URI>'
OAUTH_CLIENT_SECRET = '<client secret>'
OAUTH_CLIENT_ID = '<client id>'
OAUTH_AUTHORIZATION_ENDPOINT = '<authorization endpoint>'
OAUTH_TOKEN_ENDPOINT = '<token endpoint>'
OAUTH_INTROSPECTION_ENDPOINT = '<introspection endpoint>'
OAUTH_SCOPE = '<scopes, e.g. SESSION:ROLE-ANY>'
OAUTH_USE_SECONDARY_ROLES = TRUE; -- optional

🔎 Replace with details from your OAuth provider (Okta, Azure, etc.).


3️⃣ Grant Privileges to Use the Integration​

  • ✅ Example:
GRANT USAGE ON INTEGRATION my_oauth_integration TO ROLE analyst_role;

4️⃣ Use the Integration in Clients​

  • ✅ Clients (like BI tools, custom apps) authenticate via OAuth, get the token, and use it to connect to Snowflake.

Example for Snowflake JDBC:

authenticator=oauth
token=<access_token>

Best Practices for OAuth Integration​

  • ✅ Use trusted OAuth providers (Okta, Google, Azure AD).
  • ✅ Define scopes and roles precisely (principle of least privilege).
  • ✅ Rotate client secrets periodically.
  • ✅ Use short-lived access tokens and refresh tokens where supported.
  • ✅ Monitor login activity (LOGIN_HISTORY view) for abnormal patterns.

⚠️ Limitations and Considerations​

❌ OAuth-based connections cannot directly perform some operations (like Snowpipe auto-ingest). ❌ Requires OAuth-compatible clients (like modern BI tools or custom apps). ❌ Token management (expiration, rotation) needs careful planning.


Use Cases​

✔️ BI Tools (like Tableau, Power BI) – integrate OAuth for secure, delegated access. ✔️ Custom Apps – build secure user-facing apps without hardcoding passwords. ✔️ SSO Integration – align Snowflake access with your identity platform.


⚡ Key Takeaways​

✔️ OAuth enables secure, delegated access to Snowflake. ✔️ Snowflake works as a resource server, validating tokens. ✔️ You configure an external security integration in Snowflake. ✔️ Integrate with trusted OAuth providers to strengthen security and streamline user experience.