Simple Salesforce to Salesforce connection between two orgs using JWT certificate and Connected app (passwordless authentication)
Pre requisite —
You have 2 orgs — 1st is the receiver org and 2nd is the caller org
From the Caller org you need —
1 Certificate to sign request using JWT auth
1 Named credential
From the receiver org you need —
1 User with valid profile (and permission set if required)
1 Connected App
- Lets get started with a Certificate from the caller org
In “Certificates and key management section of setup” create a new self signed certificate in salesforce. Download this crt file using the download button
2. Now lets create a connected app in receiver org by Enable OAuth Settings checkbox and uploading the certificate (other things remain as usual) also specify some dummy endpoint url
Note down the consumer key and secret, we need them later,
also click Manage button to set Permitted Users to “Admin approved users are pre-authorized”. SAVE.
Also add the user’s profile with which you are gonna login under Profiles by clicking manage profiles button
3. In the caller org create a new Named credential using the consumer key that we just noted down (in Issuer) and select following options for JWT.
Named principal will be the username from receiver org.
4. Now lets use this named credential to call the org and get access token so that requests can be fired after authentication is done.