Implement Rest API with Cert based authentication

We have a requirement to integrate with an External Rest API via Rest API Connector. External API uses Authentication Certificate and expecting cert to be passed in header with name X-CLIENT-CERT

The certificate has been uploaded through keystore and is included in the Rest connector. We are assuming this approach is inline to the approach the client is expecting. But we aren’t seeing the expected results.

Is this the approach that needs to be implemented? Any other steps we are missing?

@KeerthiK6768 This is what I found:

To integrate with an external REST API using a REST API Connector and pass the authentication certificate in the header, you need to follow these steps:

  1. Import the certificate into a Pega Keystore instance.
  2. Configure the REST Connector to use the Keystore instance for authentication.
  3. Register the custom header with the certificate in the header processor.
    To register the custom header, you can use the following example code in an activity:

PCore.getRestClient().getHeaderProcessor().registerHeader(“X-CLIENT-CERT”, “your_certificate_value”);

Make sure to replace “your_certificate_value” with the actual certificate value. After completing these steps, the REST Connector should pass the certificate in the header as expected.

As a Support Center moderator, I reviewed the answer and references for accuracy

Managing X.509 certificates

Importing external certificates into a Pega Keystore > Steps to copy all the intermediate and/or root certificates locally

registerHeader(name, value) > Usage example

Authentication > Requests to external services from Pega Platform connectors

@KeerthiK6768Hi Keerthi

Loading certificate in connector will not serve the purpose. it is for TLS https authentication only.

In your case you have to create a custom header and pass the certificate value explicitly then it will work.