Note: For OAuth 2.0 authentication, using a refresh token is more user-friendly and secure than using an access token. The access token expires every 10 minutes and may need to be generated multiple times a day, which can prolong the process of establishing a connection and cause a security risk.

The access token authentication flow passes the token directly from the client to the Snowflake instance for authentication. The token is obtained from sources external to the flow and specified using the Access Token (AccessToken) option.

To configure the driver to use the access token flow for OAuth 2.0 authentication:

  • Set the Authentication Method (AuthenticationMethod) option to 24.
  • Set the Account Name (AccountName) option to specify the name of your account and the region where it is hosted. For example, account_name.us-east-1.
  • Set the Database Name (DatabaseName) option to specify the name of database to which you want to connect.
  • Set the Schema (Schema) option to specify 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.
  • Set the Warehouse (Warehouse) option to specify the virtual warehouse to use once connected. The specified warehouse should be an existing warehouse for which the specified default role has privileges.
  • Set the Access Token (AccessToken) option to the value of the token obtained from external sources.

    Important:

    • The access token is a confidential value used to authenticate to the server. To prevent unauthorized access, this value must be securely maintained.
    • Access tokens expire ten minutes after generation. Once connected, the access token remains valid till the session is disconnected.

The following examples show the connection information required to establish a session using the access token flow.

Connection string

DRIVER=DataDirect 8.0 Snowflake;AuthenticationMethod=24;AccountName=account_name.us-east-1;
  DatabaseName=MyDB;Schema=MySchema;Warehouse=MyWH;Token=abc12cd34efg5678h9ij87klm6543no;

odbc.ini file (32-bit)

Driver=ODBCHOME/lib/ivsnowflake28.yy
...
AuthenticationMethod=24
...
AccountName=account_name.us-east-1
...
DatabaseName=MyDB
...
Schema=MySchema
...
Token=abc12cd34efg5678h9ij87klm6543no
...
Warehouse=MyWH
...