How to configure axios to use SSL certificate?

前端 未结 4 1643
广开言路
广开言路 2020-12-02 12:39

I\'m trying to make a request with axios to an api endpoint and I\'m getting the following error: Error: unable to verify the first certificate

It seems

4条回答
  •  我在风中等你
    2020-12-02 12:52

    These configuration worked for me (In a Mutual Authentication scenario).

    const httpsAgent = new https.Agent({
      ca: fs.readFileSync("./resource/bundle.crt"),        
      cert: fs.readFileSync("./resrouce/thirdparty.crt"),
      key: fs.readFileSync("./resource/key.pem"), 
    })
    

    Note: bundle.crt was prepared from provided certificates (root,intermediate,end entry certificate). Unfortunately no clear documentation found in this regards.

提交回复
热议问题