Netflix, OAuth, and Ruby Issue APIs

I am trying to use oauth with a Riva-branch Ruby gem. I keep getting the error:

OAuth instance :: Consumer must have a marshal_load method

My code is activate.rb below. Any thoughts on how to fix this? THANKS! -Henry

require 'oauth/consumer' def index @consumer = OAuth::Consumer.new("CONSUMER KEY","CONSUMER SECRET", { :site => "http://api.netflix.com", :request_token_url => "https://api-user.netflix.com/oauth/request_token", :access_token_url => "http://api.netflix.com/oauth/access_token", :authorize_url => "https://api-user.netflix.com/oauth/login", :application_name => "AppName"}) @request_token = @consumer.get_request_token session[:request_token] =@request _token session[:request_token_secret] =@request _token.secret @authorize_url = @request_token.authorize_url({ :oauth_consumer_key => "CONSUMER KEY" :application_name => "AppName", :oauth_callback => "http://localhost:3000/activate/callback" }) redirect_to @authorize_url end def callback @request_token=OAuth::RequestToken.new(session[:request_token], session[:request_token_secret]) @access_token = @request_token.get_access_token end 
+4
source share
3 answers

The token is not serializable, so you cannot save it in a session. Store the token key and secret separately in the session instead, and create a new OAuthToken with the key and secret when you need it again.

You may need to clear the session store to get rid of the token that you already placed there.

+5
source

You need the user to physically authorize it on the Netflix website. In this case, you may be. As far as I understand, you can cache the token as soon as you received it from authorization manually.

I had similar problems with the Yammer API and I never knew it. You can check the Yammer API, Stammer, Ben Scofield in Ruby , which handles the OAuth mask

0
source

I don’t know if this is the best solution for this, but so I went around it:

I applied the following code to my environment. rb:

 class OAuth::Consumer def marshal_load(*args) self end 

More hacking, this will certainly fix the marshal’s download error. I do not know if this will cause other problems.

0
source

All Articles