skip to main content
Using the driver : Authentication : OAuth 2.0 authentication : Client credentials grant
  

Try DataDirect Drivers Now
Client credentials grant
The authentication flow for the client credentials grant exchanges client credentials for the access token at the location specified by the TokenURI.
To configure the driver to use a client credentials grant:
*Configure the minimum properties required for a connection:
*If you are using a REST file, set the Config property to provide the name and location of the input REST file. For example, C:/path/to/googleanalytics.rest.
*If you are using the Sample property, set the Sample property to specify the endpoint that the want to connect to and sample. For example, https://example.com/countries/.
*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 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 TokenURI property to specify the endpoint used to exchange authentication credentials for access tokens. For example, https://example.com/oauth2/authorize/.
*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 example demonstrates a basic Google Analytics session using a client credentials grant:
Using a connection string:
Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:AuthenticationMethod=OAuth2;
ClientID='123456789876-a1bc2de3fgh4ij567klmn8opqr9stuvw.apps.googleusercontent.com';
ClientSecret='FaZBFRsGXTaR';Config=C:/path/to/googleanalytics.rest;
TokenURI=https://accounts.google.com/o/oauth2/token;");
Using a data source:
AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAuthenticationMethod("OAuth2");
mds.setClientID("123456789876-a1bc2de3fgh4ij567klmn8opqr9stuvw.apps.googleusercontent.com");
mds.setClientSecret("FaZBFRsGXTaR");
mds.setConfig("C:/path/to/googleanalytics.rest");
mds.setTokenURI("https://accounts.google.com/o/oauth2/token");