Using Certificates with HTTP Requests
After you have generated a certificate in Salesforce, you can use it to support two-way authentication for a callout to an HTTP request.
To integrate the certificate with your Apex:
- Generate a certificate. Note the
Unique Nameof the certificate. - In your Apex, use the
setClientCertificateNamemethod of theHttpRequestclass. The value used for the argument for this method must match theUnique Nameof the certificate that you generated in the previous step.
The following example illustrates the last step of the previous procedure. This example assumes that you previously generated a certificate with a Unique Name of DocSampleCert.