RestClient::SSLCertificateNotVerified: SSL_connect

2019-02-27 14:00发布

问题:

I tried to put verify_ssl=>false to the request, but it doesn't work.

Below is my code:

def login_request (username, password)
  request_body_map = {:userName => username, :password => password}
  request_header = {:content_type => 'application/json', :accept => 'application/json'} 
  begin
    res = RestClient.post endpoint, request_body_map.to_json, {:header => request_header, :verify_ssl => false} 
    response_data = JSON.parse(res.body) 
  rescue Exception => e raise e
  end
end

回答1:

please use RestClient::Request.execute(method: :get, url: url, headers: headers, verify_ssl: false)

verify_ssl is not accepted in RestCient.method



回答2:

Try this:

def login_request (username, password)
  request = {'userName': username, 'password': password}.to_json
  url = "#{$url_host}#{$login_api}"
  begin
    res = RestClient.post(
        url,
        request,
        :content_type => :json, :accept => :json,
        :verify_ssl => false)
    response_data = JSON.parse(res.body) 
    $user_token = response_data['token'] 
    $userId = response_data['user']['userId'] 
    p response_data['user']['email'] 
  rescue Exception => e
  end
end

You can put the authentication details with :varify_ssl.



回答3:

We're facing the same exact error (B: certificate verify failed) and it's driving me nuts. This started showing up for our developers around the 10th of Oct, 2015.

In authorize.net developer forums there are many threads with the same issue, two of which are recent (first thread) (second thread) and both went dead with no resolution, these two threads started around the same time we started facing this issue, so my guess is that it has to do with authorize.net bad/new certificate with missing certificate chain.

This exact issue appeared before around 2012 and 2014 (check their developer forum), Authorize.net admitted it was a bad change they made to their certificates and then later fixed the issue, but this time it appears to be an ongoing since mid October.

PS: I tried installing every root/chain certificate on our server but this issue persists.



标签: ssl