Note: To use OAuth2 authentication, you must first register your application with Aha!. Refer to the Aha! documentation for more information.

The access token authentication flow passes the access token directly from the client to the Aha! 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 has been 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 ServerName property to the base URL of the Aha! instance to which you want to issue requests. For example, company.aha.io.
  • 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:aha://company.aha.io;authenticationMethod=OAuth2;
    accesstoken=abc12cd34efg5678h9ij87klm6543no32pqr10;");

Data Source

AhaDataSource mds = new AhaDataSource();
mds.setDescription("My Aha Data Source");
mds.setServerName("company.aha.io");
mds.setAuthenticationMethod("OAuth2");
mds.setAccessToken("abc12cd34efg5678h9ij87klm6543no32pqr10");