Configuring the driver to use OAuth 2.0
- Last Updated: July 2, 2025
- 1 minute read
- DataDirect Connectors
- JDBC
- Documentation
Prerequisites:
- Client application registered with Google Cloud
- An access token or refresh token
After you have registered your client application with Google Cloud and obtained the required OAuth information, you may configure the driver to access Google Analytics resources using OAuth 2.0.
To configure the driver, you must provide either the AccessToken or the RefreshToken in the connection URL.
- Set the AccessToken property to specify the access token you have obtained from Google. Generally, an access token is available for a short period of time and may only be used for a single session.
- Set the RefreshToken property to specify the refresh token you have obtained from Google. With a valid refresh token, the driver can obtain a new access token. In this way, a refresh token enables application access to Google for multiple sessions over an extended period of time.
The AccessToken and RefreshToken properties may both be specified. 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 ignores the AccessToken value and uses the RefreshToken value to generate a new AccessToken value.
See Obtain access and refresh tokens using the Configuration Manager for details on how to obtain an access or refresh token using the driver's Configuration Manager.
Access token example URL
Connection conn = DriverManager.getConnection
("jdbc:datadirect:googleanalytics:AccessToken=access-token;");
Refresh token example URL
Connection conn = DriverManager.getConnection
("jdbc:datadirect:googleanalytics:RefreshToken=refresh-token;");