Skip to content Skip to sidebar Skip to footer

Installing Custom Ssl Certificate In Node (unable_to_verify_leaf_signature)

I'm trying to access an API, but I'm getting the following error: { FetchError: request to https://www.cryptopia.co.nz/api/GetMarkets failed, reason: unable to verify the first cer

Solution 1:

You need to provide the whole CA chain to your application, i.e. both the missing intermediate CA certificate(s) and the root certificate:

options=require('url').parse('https://www.cryptopia.co.nz/api/GetMarkets');
options.ca = require('fs').readFileSync('myca.pem');
require('https').get(options, (r) => { 
   console.log(r.headers) 
});

myca.pem is here the concatenation of the PEM representation for the certificates of the intermediate "COMODO RSA Extended Validation Secure Server CA" and the root "COMODO RSA Certification Authority". I've provided it as pastebin here.

Post a Comment for "Installing Custom Ssl Certificate In Node (unable_to_verify_leaf_signature)"