I've tried to use this gem against httpbin's endpoints, and either the digest header hasn't been properly generated, or I'm failing to see how to set this up:
require "net/http"
require "net/http/digest_auth"
uri = URI.parse "http://httpbin.org/digest-auth/auth/user/pass"
uri.user = "user"
uri.password = "pass"
h = Net::HTTP.new uri.host, uri.port
h.set_debug_output $stderr
req = Net::HTTP::Get.new uri.request_uri
res = h.request req
digest_auth = Net::HTTP::DigestAuth.new
auth = digest_auth.auth_header uri, res["www-authenticate"], "GET"
req = Net::HTTP::Get.new uri.request_uri
req.add_field "Authorization", auth
res = h.request req
puts
puts "passed" if res.code == "200"
puts "failed" if res.code != "200"
I've tried to use this gem against httpbin's endpoints, and either the digest header hasn't been properly generated, or I'm failing to see how to set this up: