The authentication flow for the client credentials grant exchanges client credentials for the access token at the location specified by the TokenURI. Web-based login and consent are not required. The following string includes the properties used to connect with the client credentials grant.

jdbc:datadirect:snowflake:AccountName=account_name;AuthenticationMethod=OAuth2;
DatabaseName=database_name;Schema=schema_name;Warehouse=warehouse_name;
ClientID=client_id;ClientSecret=client_secret;
TokenURI=token_uri;[property=value[;...]];

where:

account_name

specifies the full name of your account with region and cloud platform.

database_name

specifies the name of the database to which you are connecting.

schema_name

specifies the default schema to use for the specified database once connected. The specified schema should be an existing schema for which the specified default role has privileges.

warehouse_name

specifies the virtual warehouse to use once connected. The specified warehouse should be an existing warehouse for which the specified default role has privileges.

client_id

specifies the client ID for your application.

client_secret

specifies the client secret for your application.

Important: The client secret is a confidential value used to authenticate the application to the server. To prevent unauthorized access, this value must be securely maintained.
token_uri

specifies the endpoint from which the driver fetches access tokens.

property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.

The following example connection string includes the properties for connecting with the OAuth 2.0 client credentials grant.

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:snowflake:AccountName=account_name.us-east-1;
    AuthenticationMethod=OAuth2;DatabaseName=payroll;Schema=xyz;Warehouse=accounting;
    ClientID=cd34efg5678h9ij87klm6543no32pqr10st987;ClientSecret=098zyx765wvu432tsr123qpo456;
    TokenURI=https://account_name.us-east-1.snowflakecomputing.com/oauth/token-request;");