Access token flow
- Last Updated: March 24, 2025
- 2 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
The access token authentication flow passes the access token directly from the client to the REST service for authentication. The access token is obtained from external resource or from tools, such as the Configuration Manager or Postman, and specified using the AccessToken property.
Note: As opposed to using a third-party application such as Postman, you can use the
Progress DataDirect Autonomous REST Connector Configuration Manager to obtain an access
token to support the access token flow. See Obtaining access and refresh tokens using the Configuration Manager for details.
To use an access token flow:
- The application should be configured to set the AccessToken property to
specify the access token required to authenticate to a REST service.Note: Access tokens typically expire ten minutes after generation. Once connected, the access token remains valid till the session is disconnected.
- Configure the minimum properties required for a connection:
- If you are using a Model file, set the Config property to provide the name and location of the Model file. For example, C:/path/to/yelp.rest.
- If you are using the Sample property, set the Sample property to
specify the endpoint that you want to connect to and sample. For example,
https://example.com/countries/.
- Set the AuthenticationMethod property to
OAuth2-AccessToken.Note: To support existing configurations, the AuthenticationMethod property will continue to support theOAuth2value for the access token flow. - Optionally, specify values for a custom HTTP header to be used for authentication,
such as those used in tenant ID authentication:
- Set the AuthHeader property to specify the name of the HTTP header used for authentication.
- Set the SecurityToken property to specify the ID value of the HTTP header named by the AuthHeader option.
- Optionally, set the ClientCredentialsMode property to determine how client credentials
must be specified in a request to obtain an access token when using OAuth 2.0. Configure
this property for flows that require client credentials to be specified in only a basic
authentication header or only as a URL parameter.
- If set to
all, the client credentials must be specified in a basic authentication header and as URL parameters. This is the default setting. - If set to
basic, the client credentials must be specified using a basic authentication header. - If set to
url, the client credentials must be specified as URL parameters.
- If set to
The following examples demonstrate a basic configuration for Yelp™ using an access token flow:
Using a connection URL:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:AccessToken='C3TQH9zjwek4CgJCU-4Mxb2DxLNfI2LB3a-dNfpWYx';
AuthenticationMethod=OAuth2-AccessToken;Config=C:/path/to/yelp.rest;");
Using a data source:
AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAccessToken("C3TQH9zjweek4CgJCU-4Mxb2DxPLNfI2LB3a-dNfpWnYx");
mds.setAuthenticationMethod("OAuth2-AccessToken");
mds.setConfig("C:/path/to/yelp.rest");