Creating an External Credential for Basic Auth (Setting up Named Credentials, part 1)
The purpose of this series of articles is to guide you through the creation of an External Credential for Basic Authentication. This step is a prerequisite to create and use Named Credentials for your Language I/O integration in Salesforce.
Note: This article is a condensed version of the official Salesforce documentation. For full details, see the following articles in the Salesforce Help Center:
To use Named Credentials, you must first create an External Credential, then use this External Credential to create a Custom Header for authentication.
Step 1: Create an external credential
- Go to Setup > Named Credentials.
- Click on the External Credentials subtab, then click New. The following window opens:
- Enter a descriptive Label and Name. The Name field can contain only underscores and alphanumeric characters. The chosen name must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
- Set the Authentication Protocol to Custom.
- Click Save.
Step 2: Create Principals to store the authentication parameters
- Open the External Credential you created in the previous step.
- Under Principals, click New. The following window opens:
- Type the Parameter Name (for example, chat).
- (Optional) Set the Sequence Number. Use this if users have multiple Permission Sets used in multiple Permission Set Mappings. The Sequence Number determines which of the mappings “wins” and gets used for the callout, sorted from lowest to highest.
- The Identity Type is set to Named Principal. It indicates that Salesforce users share the same API key, and that they do not have unique access to the external service. You cannot change this.
- Click Add to create an Authentication Parameter, and enter “Username” in the Name.
- Enter your Language I/O API username in the Value of the Authentication Parameter and click Save.
- Click Add to create another Authentication Parameter, and enter “Password” in the Name.
- Enter your Language I/O API password in the Value of the Authentication Parameter.
- Click Save.
Step 3: Add a Custom Header
- When viewing the External Credential, click New under& Custom Headers. The following window opens:
- Enter “Authorization” in the Name of the header.
- Enter the following Value:
{!'Basic ' & BASE64ENCODE(BLOB($Credential.[External Credential Name].Username & ':' & $Credential.[External Credential Name].Password))}
. In the current example, the value would be{!'Basic ' & BASE64ENCODE(BLOB($Credential.BasicAuth.Username & ':' & $Credential.BasicAuth.Password))}
Note: When you enter the value, replace "[External Credential Name]" in the sample above with the name of your External Credential. - Leave the Sequence Number set to the default.
- Click Save.
Next step
Proceed to Create a Named Credential.
Comments
0 comments
Please sign in to leave a comment.