Salesforce OAuth JWT Connection in MuleSoft

Apisero
3 min readJul 20, 2022

--

Author: Prathamesh Bhandwalkar

● Login to the salesforce account.

● Go to setup.

● Go to Certificate and Key Management (you can search in Quick Find on the left side)

● Click on Create a Self Signed Certificate

● Enter a unique label name and save.

● Download the certificate.

● Comeback to Certificate and Key Management and click on “Export to Keystore” to download the keystore file.

● Enter a Keystore password and save it for later use.

● Goto Apps > App Manager > New Connected App.

● Set Connected App Name and Contact Email in the Basic Information section.

● Select the Enable OAuth Settings check box.

● Set up the Callback URL.

● Select the Use digital signatures check box and upload the certificate we downloaded.

● Add the Selected Oauth Scopes.

○Manage User Data via APs (api).

○ Perform requests at any time (refresh_token,offline_access).

○ Manage User Data via Web browsers (web).

● Save the Connected App.

● Note down the consumer key

● Go to the Manage > Edit Policies.

● Change Permitted Users to Admin approved users are pre-authorized and select OK to the pop-up notification and save.

● Go to App Manager, select the connected app we have created from the list, use the drop-down arrow at the right-most side of our connected app, and select Manage.

● Goto Manage Profiles section and add the required profiles and Save.

● Goto Anypoint Studio

● In the Salesforce Config Tab select OAuth JWT as the connection

● Add the required configuration details

○ Consumer key of your created App

○ Path to keystore file that you downloaded

○ Keystore password that you created

○ Email id that you specified while creating the App

○ Token Endpoint should be as below

--

--