我正在尝试将 oauth 与稀有分支 Ruby gem 一起使用。我不断收到错误:
OAuth::Consumer 的实例需要有方法“marshal_load”
我的代码 activate.rb 如下。关于如何解决这个问题的任何想法?谢谢!-亨利
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