The access token authentication flow passes the access token directly from the client to the HubSpot service for authentication. Unlike other grant types, authentication credentials, such as authorization codes, are not exchanged in return for the access code. Instead, the access token is obtained from sources external to the flow and specified using the AccessToken property.

Note: Access tokens are temporary and must be replaced to maintain the session without interruption. The life of an access token is typically one hour.

To configure the driver to use an access token flow:

  • Set the AuthenticationMethod property to OAuth2.
  • Set the AccessToken property to the value of the access token obtained from external sources.

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

Connection URL

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:hubspot:
    AuthenticationMethod=OAuth2;
    AccessToken=C3TQH9zjwek4CgJCU-4Mxb2DxLNfI2LB3a-dNfpWYx;");

Data Source

HubSpotDataSource mds = new HubSpotDataSource();
mds.setDescription("My HubSpot Data Source");
mds.setAuthenticationMethod("OAuth2");
mds.setAccessToken("C3TQH9zjweek4CgJCU-4Mxb2DxPLNfI2LB3a-dNfpWnYx");