authentication example

38 views
Skip to first unread message

Ilya Makedon

unread,
Apr 18, 2020, 3:30:15 PM4/18/20
to checkvist-api
Is there an example of working authentication by a checkvist api client (preferably in Ruby)?  I'd really like to see something that works given just the user's email and password.

I don't seem to be able to follow the rather terse instructions here.  

I also tried searching this group for 'authentication', 'auth', etc.

I also searched github for 'checkvist'.  I even cloned a project.  But it failed with sort of the same issue I'm having.
.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/net/http/response.rb:122:in `error!': 301 "Moved Permanently" (Net::HTTPRetriableError)


KIR

unread,
Apr 18, 2020, 3:35:29 PM4/18/20
to checkvist-api
The github sample uses http:// protocol, not https:// - probably that's the reason

Ilya Makedon

unread,
Apr 19, 2020, 2:40:25 AM4/19/20
to checkvist-api
I figured it to.  So for anybody that's looking for example of making a calle in Ruby, here it is:

def http_get email, key parameters = nil 


  uri = URI.parse(url_s)

  request = Net::HTTP::Get.new(uri.path)
  request.basic_auth email, key
  request.set_form_data(parameters) if parameters


  response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|
    http.request(request)
  end

  case response
    when Net::HTTPSuccess
      response.body
    else
      response.error!
  end
end
Reply all
Reply to author
Forward
0 new messages