Salesforce OAuth JWT connection in MuleSoft
- July 14, 2022
Let’s create a Salesforce OAuth JWT connection in MuleSoft:
- Log in to your Salesforce account
- Go to Setup
- Go to Certificate -> Key Management (you can search in Quick Find on the left side)
- Click Create Self-Signed Certificate
- Enter a unique label name
- Click Save
- Download the certificate
- Return to Certificate -> Key Management and click “Export to Keystore” to download the keystore file
- Enter a Keystore password and save it for later use
- Go to Apps -> App Manager -> New Connected App
- Set a 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 previously downloaded certificate
- Add the Selected Oauth Scopes
- Manage user data via APIs (api)
- Perform requests at any time (refresh_token,offline_access)
- Manage user data via web browsers (web)
- Save the Connected App
- Write down the consumer key
- Go to Manage -> Edit Policies
- Change Permitted Users to Admin Approved Users are Pre-authorized and select OK to the pop-up notification and click Save
- Go to App Manager, select the connected app you created from the list, use the drop-down arrow at the right-most side of the connected app and select Manage
- Go to Manage Profiles, add the required profiles and click Save
- Go to 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 the Keystore file you downloaded
- Keystore password you created
- Email ID you specified while creating the app
The token endpoint should be:
- For a trial/production account: https://login.salesforce.com/services/oauth2/token
- For a sandbox account: https://test.salesforce.com/services/oauth2/token
— By Prathamesh Bhandwalkar