Obtaining access and refresh tokens using the Configuration Manager
- Last Updated: May 1, 2023
- 2 minute read
- DataDirect Connectors
- JDBC
- Documentation
You need the following information before you begin.
- The client ID and client secret for the client application
- The scope or scopes that define permissions for the client application
The Configuration Manager uses the authorization code grant to obtain access and refresh tokens from Google Cloud. The following steps describe how you can use the Configuration Manager to obtain access and refresh tokens. In addition, the Configuration Manager produces a connection URL that you can use in your application.
- Open the Configuration Manager by double-clicking the driver jar file. Alternately, from the
command line, navigate to the directory containing your driver jar file, and then
execute the following command:
java -jar googleanalytics4.jarStep result: The Configuration Manager opens in your default web browser.
- Enter values for the required connection properties under the
Connection tab.
- Client ID
- Client Secret
- Scope
The following scopes are the default scopes used by the driver.
- View and download
data:
https://www.googleapis.com/auth/analyticshttps://www.googleapis.com/auth/analytics.readonly - View user
permissions:
https://www.googleapis.com/auth/analytics.manage.users.readonly
- View and download
data:
- Enter any additional values under the Connection tab, or other tabs, as desired.
- Retrieve access and refresh tokens:
- Click Fetch OAuth Token.
- If prompted, enter your Google credentials.
- Provide consent to allow the Configuration Manager to retrieve the tokens.
- The Access Token and Refresh Token fields populate with values retrieved from Google Cloud.
- Click Test Connect to verify connectivity and run SQL queries against the service.
Results:
The Access Token and Refresh Token fields contain access and refresh tokens. You can use these tokens to configure the driver and access Google Analytics resources.
The connection string in the Connection String field may be copied and used in your JDBC application to access Google Analytics resources.