You need the following information before you begin.

  • Sample endpoint: The endpoint of the service to which you are connecting
  • Authorization URI: The endpoint for obtaining an authorization code from a third-party authorization service
  • Token URI: The endpoint used to exchange authentication credentials for access tokens
  • Client ID: The client ID for your application
  • Client Secret: The client secret for your application
  • Scope: An OAuth scope, or a space-separated list of OAuth scopes, which specifies the permissions that limit application access to the service.
Note: You can also use the Autonomous REST Composer (administrator view) to obtain refresh tokens as described in this section. For general information on launching the Autonomous REST Composer, see "Getting started with prebuilt Model files" or "Generating a Model file with the Autonomous REST Composer."

The following steps describe how you can use the Progress DataDirect Autonomous REST Connector Configuration Manager to obtain access and refresh tokens for either the access token flow or the refresh token grant. In addition, the Configuration Manager produces a connection URL that you can use in your application.

Note: You must allow popups in your browser to obtain access tokens with the Configuration Manager.
  1. Open the Autonomous REST Configuration Manager by double-clicking the driver jar file. Or, in a command line, navigate to the directory containing your driver jar file; then, execute the following command:
    java -jar autorest.jar

    The Autonomous REST Configuration Manager opens in your default web browser.

  2. Set Authentication Method to OAuth2.
  3. Provide the following information in the fields provided.
    • Sample
    • Authorization URI
    • Token URI
    • Client ID
    • Client Secret
    • Scope (if required by your REST service)
  4. Obtain access tokens.
    1. Click Fetch OAuth Token.
    2. If the logon popup appears, enter your credentials. (This popup may not appear if you previously logged on.)
    3. If consent popup appears, provide consent, allowing the Configuration Manager to retrieve the tokens. (This popup may not appear if you previously provided consent to the Configuration Manager.)
    4. The Access Token and Refresh Token fields populate with values retrieved from the OAuth authorization server.
  5. Click Test Connect to verify connectivity and run SQL queries against the service.

Results:

The Access Token and Refresh Token fields include access tokens refresh tokens that you can use to implement OAuth 2.0.

The connection string in the Connection String field may be copied and used in your JDBC application to connect with your REST service.

Note:

Not all the values in the resulting connection string are required. However, the connection string can be copied directly into your JDBC application. The driver ignores any values that do not apply to your OAuth implementation.

For example, the refresh token grant connection string, derived from the Configuration Manager, might include the following properties.

jdbc:datadirect:autorest:Sample=endpoint;AuthenticationMethod=OAuth2;
AuthURI=auth_uri;TokenURI=token_uri;
ClientID=client_id;ClientSecret=client_secret;
AccessToken=access_token;Scope=scope;

However, only the following properties are required for an refresh token grant connection string.

jdbc:datadirect:autorest:Sample=endpoint;Authentication Method=OAuth2;
TokenURI=token_uri;ClientID=client_id;
ClientSecret=client_secret;AccessToken=access_token;