skip to main content
Using the driver : Authentication : Configuring OAuth 2.0 authentication
  

Try DataDirect Drivers Now

Configuring OAuth 2.0 authentication

The driver supports OAuth 2.0, which is an open protocol for token-based authentication. OAuth 2.0 allows you to authenticate without specifying a user ID or password, eliminating the risk of exposing them to unauthorized access. It uses an access token, accompanied by the values discussed below, to authenticate to a Salesforce instance. Refer to the Salesforce documentation to know how to obtain an access token.
To configure the driver to use OAuth 2.0 authentication, set the following connection properties:
*Set the AuthenticationMethod property to oauth2.0.
*Set at least one of the following properties:
*AccessToken: Set this to specify the access token you have obtained from Salesforce.
*RefreshToken: Set this to specify the refresh token you have obtained from Salesforce.
If a value for the AccessToken property is not specified, the driver uses the value of the RefreshToken property to make a connection. If both values are not specified, the driver cannot make a successful connection. If both are specified, the driver ignores the AccessToken value and uses the RefreshToken value to generate a new AccessToken value.
*Set the ClientID property to specify the consumer key for your application.
*Set the SchemaMap property to specify either the name or the absolute path and name of the configuration file where the map of the Salesforce data model is written. Note that a value for the SchemaMap property must be specified every time you authenticate to a Salesforce instance using OAuth 2.0.
*Optionally, set the ClientSecret property to specify the consumer secret for your application.
The following example shows how to connect to a Salesforce instance using OAuth 2.0 authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:sforce://login.salesforce.com;AuthenticationMethod=oauth2.0;
SchemaMap=ABC;clientId=RaARBTsXZTeN4Qx67qPLOS;RefreshToken=YaTARBsRZLeM4Px47qSOLP;
AccessToken=ZbTARBsRZLeM4Px56qOLPS;","","");