External system using “Named Credential” Following are the steps to connect:
● Create a Connected App (Only 1 in each source org)
● Create an Authorization Provider (Only 1 in each source org)
● Define Named Credential (Multiple named credentials based on # of destination org which users want to connect with this source org)
Create a Connected App:
● Navigate to setup and write “app man” in Quick Find / Search. And select the App Manager.
● Click on New Connected App Button.
● Provide all necessary information
● Check “Enable OAuth Settings” checkbox to use OAuth
● In “Callback URL” enter the temporary Salesforce URL. (We need to modify this later on)
● We will come back again on this step later to provide Callback URL
● Select the scope
● Finally click on Save.
“Consumer Key” and “Consumer Secret” will be provided once you save this. We need this information for the next step.
Screenshot:
Create Authorization Provider:
● Navigate to Setup →Identity → Auth. Providers →click on New.
● Select “Salesforce” as Provider Type
● Provide all necessary information
● Provide “Consumer Key” and “Consumer Secret” from the previous step(Copy this from the connected app which we’ve created in the previous step)
● Authorize Endpoint URL & Token Endpoint URL.
1. If you are creating in a Production org.
Authorize Endpoint URL: https://login.salesforce.com/services/oauth2/authorize
Token Endpoint URL: https://login.salesforce.com/services/oauth2/token
2. If you are creating in a Sandbox org.
Authorize Endpoint URL: https://test.salesforce.com/services/oauth2/authorize
Token Endpoint URL: https://test.salesforce.com/services/oauth2/token
● Default Scope: – enter the value as “refresh_token full”
● Click on Save.
Please Note:
“Once you save, it will provide you the set of URLs in ‘Salesforce Configuration’ section on the same page.” “Copy ‘Callback URL’ and edit the Connected App which we have created in the previous step and set this URL as Callback URL.”
Screenshot:
Define Named Credential:
● Navigate to Setup →Security →Named Credentials →Click on New Legacy.
● Provide the name (label)
● URL: – Provide the Destination ORG’s instance URL (Copy from home page of Salesforce Classic Not from lightning)
● Example: https://isyncsfdemo-dev-ed.my.salesforce.com/
● Select “Named Principal” as Identity Type. And “OAuth 2.0” as Authentication Protocol.
● Authentication Provider: – Select the Auth provider which we’ve just created in the 2nd step.
● Scope: – enter the value as “refresh_token full”
● Check “Start Authentication Flow on Save” (this is important) and save.
Screenshot:
● That’s it. We are all set to use Named credential to create new Org Master.