To use OAuth 2.0 authentication with Snowflake, create a security integration and obtain the client ID and client secret required for the connection.
<your_integration> with a name for the security integration.
USE ROLE ACCOUNTADMIN;
CREATE SECURITY INTEGRATION <your_integration>
TYPE = OAUTH
ENABLED = TRUE
OAUTH_CLIENT = CUSTOM
OAUTH_CLIENT_TYPE = 'CONFIDENTIAL'
OAUTH_REDIRECT_URI = 'http://localhost:58088'
OAUTH_ISSUE_REFRESH_TOKENS = TRUE
OAUTH_REFRESH_TOKEN_VALIDITY = 7776000;
OAUTH_REFRESH_TOKEN_VALIDITY specifies the refresh token validity period in seconds. The value can range from 86400 (1 day) to 7776000 (90 days). The default value is 7776000 (90 days).
To verify that the security integration was created successfully, run the following script:
USE ROLE ACCOUNTADMIN;
DESC SECURITY INTEGRATION <your_integration>;
USE ROLE ACCOUNTADMIN;
SELECT system$show_oauth_client_secrets('<your_integration>');