peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

unable to verify the first certificate #127

Closed Bastl34 closed 5 years ago

Bastl34 commented 5 years ago

Hi.

I'm currently getting an unable to verify the first certificate error. -->

{ Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket._finishInit (_tls_wrap.js:633:8)
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
  config:
   { adapter: [Function: httpAdapter],
     transformRequest: { '0': [Function: transformRequest] },
     transformResponse: { '0': [Function: transformResponse] },
     timeout: 10000,
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     headers: { Accept: 'application/json', 'User-Agent': 'axios/0.18.1' },
     method: 'get',
     debug: false,
     url: 'https://discovery.meethue.com/',
     data: undefined },

The SSL Cert seems to be updated on June 13, 2019. Is there maybe an issue with this new cert?

Is anyone else is having this problem?

It seems to be working on windows but not on my raspberry pi.

Bastl34 commented 5 years ago

A check with openssl has the same result

openssl s_client -connect "discovery.meethue.com:443" -showcertsopenssl s_client -connect "discovery.meethue.com:443" -showcerts

--> Verify return code: 21 (unable to verify the first certificate)

peter-murray commented 5 years ago

The intermediate certificate appears to not be in the standard Node.js CA Roots, so that causes this issue.

I have fixed this already in the in the v3 version I am working on, I will back port the changes to resolve this later today..

peter-murray commented 5 years ago

Version 2.4.6 has just been published and resolved this issue you are facing, please give it a try.

Bastl34 commented 5 years ago

Great. Thank you.