The refresh token grant is used to replace expired access tokens with active ones by exchanging the refresh token at the endpoint specified by the TokenURI property.

To configure the driver to use the refresh token grant:

  • Set the AuthenticationMethod property to OAuth2.
  • Set the ClientID property to specify the client ID key for your application.
  • Set the ClientSecret property to specify 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.
  • Set the RefreshToken property to specify the refresh token used to request a new access token or renew an expired one.
    Important: The refresh token is a confidential value used to authenticate to the server. To prevent unauthorized access, this value must be securely maintained.
  • Optionally, set the Scope property to specify a space-separated list of OAuth scopes to limit the permissions granted by the access token.

The following examples show the connection information required to establish a session using the refresh token grant.

Connection URL

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:hubspot:
    AuthenticationMethod=OAuth2;ClientID=ab123c45-def6-7g89-gh1i-m2345no67891;
    ClientSecret=12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd;
    RefreshToken=12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;");

Data Source

HubSpotDataSource mds = new HubSpotDataSource();
mds.setDescription("My HubSpot Data Source");
mds.AuthenticationMethod("OAuth2");
mds.ClientID("ab123c45-def6-7g89-gh1i-m2345no67891");
mds.ClientSecret("12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd");
mds.RefreshToken("12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831");