Configuring the driver to use OAuth 2.0 with JWT grant
- Last Updated: March 2, 2023
- 1 minute read
- DataDirect Connectors
- JDBC
- Salesforce 6.0
- Documentation
Prerequisites:
- A client application registered as a Salesforce Connected App.
- A JWT certificate containing the private key for the registered application.
After you have registered your client application as a Salesforce Connected App and obtained the required OAuth information, you may configure the driver to access Salesforce resources using OAuth 2.0. with JWT grant.
To configure the driver, set the following connection properties:
- Set the AuthenticationMethod property to
oauth2.0. - Set the JWTCertStore property to specify the file path to the certificate store containing the private key for your application.
- Set the ClaimsIssuer property to specify the client ID or consumer key of the Salesforce Connected App.
- Set the ClaimsSubject property to specify the username of the user.
- 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.
- Set the JWTCertPassword property to specify the password for the JWT certficate, if any.
- Set the JWTCertAlias property to specify an alias for the JWT certficate, if any.
JWT grant example URL
Connection conn = DriverManager.getConnection
("jdbc:datadirect:sforce://login.salesforce.com;AuthenticationMethod=oauth2.0;
SchemaMap=schema-map-name;JWTCertStore=file-path;
ClaimsIssuer=client-ID;ClaimsSubject=user-name;
JWTCertPassword=certificate-password;JWTCertAlias=certificate-alias");