ruby - Get HTTP error RestClient::Unauthorized (401 Unauthorized): Using 'rest-client' gem in rails -


I used Ruby Gems the rest of the client to request a URL to a website. And I get the following error ...

  Privileges: unauthorized (401 unauthorized): app / controller / API / V1 / channel_controller RB: 199: In `Streaming_Link ' 

Help me fix it. My controller method is

  def streaming_link url = URI.encode ("http://eboundservices.com/hash/hash_app.php?code=orientplay") Results = RestClient :: Request New ( {: User = & gt; "Hashpe",: Password = & gt; "PlayFair00" ,: method = & gt;: post ,: url = & gt; url}) Return: json = & gt; {: Success = & gt; Truth,: result => Result} end  

I was also struggling with the rest of the customer and until a 401 I did not get the recognition that this was a requirement of service due to Digest authentication. .

Instead I switched, which supports it and works with it. Maybe it's the same with your 401.

  @auth = {: username = & gt; 'Hashpe' ,: Password = & gt; 'PlayFair00'} option = {: digest_auth = & gt; @auth} response = HTTParty.get ('http://eboundservices.com/hash_hap.php?code=orientplay', option)  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -