February 2, 2022
Setting up Connected app, Auth Provider, and Named Credentials
Create a Connected App (App > App Manager > New Connected App)
- Connected App Name: Provide a unique value that description the app
- API Name: Keep the default.
- Contact Email: Enter a valid contact email
- Enable OAuth Settings: Check this bot to reveal the OAuth settings
- Callback URL: The callback URL will be set in a later set. Set to https://www.login.com for now.
- Choose the scopes required for the app. The following scopes are required at a minimum (but identify the full set of scopes based on your integration requirements):
- Full access (full)
- Perform requests at any time (refresh_token, offline_access)
- Save the record.
- Note the Consumer Key and Consumer Secret. These values will be needed for the next step.
Create an Auth. Provided (Identity > Auth. Providers > New)
Provider Type: Choose Salesforce
- Name: Enter a unique name
- Consumer Key: Enter the consumer key noted from the Connected App creation.
- Consumer Secret: Enter the consumer secret noted from the Connected App Creation.
- Keep the remaining defaults.
- Save the record.
- Note the Callback URL defined after the save.
Update the Connected App (Apps > App Manager > Edit)
- Update the Callback URL
- Save the record
Create a Named Credential (Security > Named Credentials > New Named Credential)
- Label: Enter a unique name for the Named Credential.
- Name: Keep the default.
- URL: Enter the Salesforce URL (NOTE: Do not use the [domain].lightning.force.com). If not known, run the following in dev console execute anonymous: system.debug(url.getOrgDomainUrl());
- Identity Type: Named Principal (This assumes there will be one named principal users under which the Salesforce to Salesforce logic will run. Choose Per User if each login needs to be identified).
- Authentication Protocol: OAuth 2.0
- Authentication Provider: The Auth. Provider previously defined.
- Scope: refresh_token full
- Start Authentication Flow on Save: Checked
- Save the record.
- Saving the record will kick off an authentication request.
- Authenticate by successfully logging in.