Internal Authentication Setup
Last updated
Last updated
As authentication token is required for callout, Named Credential needs to be set up for establishing the connection.
Create a Connected App to generate Consumer ID and Consumer Secret
Setup -> App Manager -> New Connected App
b. Fill in the required details:
Connected App Name, API Name, Contact Email
c. Enable OAuth Settings and provide below details.
Initially set Callback URL as a dummy URL(e.g., https://test.salesforce.com). This value can be updated in further steps.
Select OAuth Scopes as Manage user data via APIs(api) and Perform requests at any time (refresh_token, offline_access).
d. Leave other fields as it is and Save the record. Click on the Manage Consumer Details button and copy the Consumer Key and Secret.
Note: This will require verification code which will be sent to the current user email address.
Create an Auth. Provider using the Consumer ID and Consumer Secret generated in above step
Setup -> Auth. Provider -> New
Select Provider Type as ‘Salesforce’
Provide Name, URL suffix, Consumer Key and Consumer Secret
Save the record
Copy the call back URL from Auth. Provider and update the same in the Connected App created in Step 1.
Note: Callback URL will be auto populated based org domain URL(i.e., Sandbox or Production).
Go to Setup -> App Manager -> <Connected App Created in Step 1> -> Edit
Update the Call Back URL and Save the record.
Click on Manage button on this Connected App record.
Click on the Edit Policies.
Set the OAuth Policies as below and Save the record.
Note: IP Relaxation should be considered as per company policy.
Create an External Credential with the Auth. Provider, Permission Set
Click on the "New" button.
Fill in the required fields and add Auth. Provider created in above step, and click on the save.
Under Principals, create a new Named Principal in External Credential.
Add the above created principal access in the current user's Profile or using a Permission Set.
Note: If providing access through a Permission Set, the current user should be assigned with the same permission set.
Create a Named Credential using the above External Credential
Click on New, fill in required fields.
Use the current org domain of the Callback URL in the URL field.
Select the External Credential created in above step.
Enable allow Formulas in HTTP Header and provide allowed Namespace as ‘lwapic’.
Save the record.
Authenticate the Named Principal on External Credential
a. Navigate to the External Credential and under Principals section, Authenticate the principal added.
b. It will redirect to authenticate the current user login page.
c. Upon successful authentication, the Authentication Status will change from Not Configured to Configured.
Copy the API name of the Named Credential created above.
In App Settings custom setting, add the above API name in the Current Org Named Credential field as value under Default Organization values.
a. Setup -> Custom Settings -> App Settings -> Manage
b. Add new record or edit existing record
c. Set Current Org Named Credential field with Named Credential API Name value
After passing the value click on the save .