I have a url which points to a JSON output, however this URL requires a username and password through a standard apache pop up authentication box. I have tried to access this URL from my rails controller like the following:
result = JSON.parse(open("http://user:[email protected]/json").read)
However it isn't working. I have the following at the top of my controller:
require 'open-uri'
require 'json'
I just get an error which says ArgumentError, userinfo not supported. [RFC3986]
try to password and user as additional option
open("http://...", :http_basic_authentication=>[user, password])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With