RestClient::SSLCertificateNotVerified: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

后端 未结 3 1443
不思量自难忘°
不思量自难忘° 2021-01-23 00:46

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

Below is my code:

def login_request (username, password)
  reques         


        
3条回答
  •  失恋的感觉
    2021-01-23 01:19

    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.

提交回复
热议问题