Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Im getting the following error:

undefined method `authorize_from_request'

Based on the documenation here: http://oauth.rubyforge.org/rdoc/classes/OAuth/Consumer.html That method doesnt exist, but I saw this method used here: http://teachmetocode.com/screencasts/oauth-with-the-twitter-gem/ and so I'm guessing it was deprecated some time ago, but I can't seem to find its replacement and was wondering what other way could I go about solving this issue?

Thanks in Advance!

Controller Code:

    class TwitterController < ApplicationController
      def index

      end

      def login
        oauth_request_token = oauth.get_request_token(:oauth_callback => "http://gnome.local/twitter/finalize")

        session[:request_token] = oauth_request_token.token
        session[:request_secret] = oauth_request_token.secret

        redirect_url = oauth_request_token.authorize_url
        redirect_url = "http://" + redirect_url unless redirect_url.match(/^http:\/\//)

        redirect_to redirect_url
      end

      def finalize
        oauth.authorize_from_request(session[:request_token], session[:request_secret], params[:oauth_verifier])

        @client = Twitter::Client.new(oauth).verify_credentials

        session[:request_token] = nil
        session[:request_secret] = nil
        oauth_access_token = oauth.get_access_token
        @oauth_token = session[:oauth_token] = oauth_access_token.token
        session[:oauth_secret] = oauth_access_token.secret
      end

      def client
        oauth.authorize_from_access(session[:auth_token])
      end

      def oauth
        @oauth ||= OAuth::Consumer.new(APP_CONFIG[:twitter][:consumer_key], APP_CONFIG[:twitter][:consumer_secret], :site => "http://api.twitter.com", :request_endpoint => "http://api.twitter.com", :sign_in => true);
      end

    end

(Original Post: http://groups.google.com/group/oauth-ruby/browse_thread/thread/614b27e4f5d80fab)

share|improve this question
add comment

1 Answer

Got the same problem, the solution is to use according to the (old) Twitter gem:

request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.