skip to main content
Using the driver : Authentication : Configuring OAuth 2.0 authentication
  

Try DataDirect Drivers Now

Configuring OAuth 2.0 authentication

The driver supports OAuth 2.0, which is an open protocol for token-based authentication. OAuth 2.0 allows you to authenticate without specifying a user ID or password, eliminating the risk of exposing them to unauthorized access. It uses an access token, accompanied by the values discussed below, to authenticate to a Google BigQuery instance. See "Generating access token and refresh token" to know how to obtain an access token.
To configure the driver to use OAuth 2.0 authentication, set the following connection properties:
*Set the AuthenticationMethod property to oauth2.
*Set at least one of the following properties:
*AccessToken: Set this to specify the access token you have obtained to authenticate to Google BigQuery.
*RefreshToken: Set this to specify the refresh token you have obtained to authenticate to Google BigQuery.
If a value for the AccessToken property is not specified, the driver uses the value of the RefreshToken property to make a connection. If both values are not specified, the driver cannot make a successful connection. If both are specified, the driver uses the AccessToken value; however, if the AccessToken value expires, it uses the RefreshToken value to generate a new AccessToken value.
*Set the ClientID property to specify the consumer key for your application.
*Set the ClientSecret property to specify the consumer secret for your application.
*Optionally, set the Scope property to specify the OAuth scope. It limits the permissions granted by an access token.
The following example shows how to connect to a Google BigQuery instance using OAuth 2.0 authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:googlebigquery:AuthenticationMethod=oauth2;
Project=myproject;Dataset=mydataset;AccessToken=abcdefghi12345678;
RefreshToken=wxyz123456789;ClientID=123abc.apps.googleusercontent.com;
ClientSecret=ab123xy","","");