app/controllers/sessions_controller.rb in mbleigh-twitter-auth-0.1.21 vs app/controllers/sessions_controller.rb in mbleigh-twitter-auth-0.1.22

- old
+ new

@@ -1,9 +1,12 @@ class SessionsController < ApplicationController + unloadable + def new if TwitterAuth.oauth? - @request_token = TwitterAuth.consumer.get_request_token + oauth_callback = request.protocol + request.host_with_port + '/oauth_callback' + @request_token = TwitterAuth.consumer.get_request_token({:oauth_callback=>oauth_callback}) session[:request_token] = @request_token.token session[:request_token_secret] = @request_token.secret url = @request_token.authorize_url url << "&oauth_callback=#{CGI.escape(TwitterAuth.oauth_callback)}" if TwitterAuth.oauth_callback? @@ -32,11 +35,12 @@ authentication_failed('Authentication information does not match session information. Please try again.') and return end @request_token = OAuth::RequestToken.new(TwitterAuth.consumer, session[:request_token], session[:request_token_secret]) - @access_token = @request_token.get_access_token + oauth_verifier = params["oauth_verifier"] + @access_token = @request_token.get_access_token(:oauth_verifier => oauth_verifier) # The request token has been invalidated # so we nullify it in the session. session[:request_token] = nil session[:request_token_secret] = nil @@ -46,10 +50,10 @@ session[:user_id] = @user.id cookies[:remember_token] = @user.remember_me authentication_succeeded - rescue Net::HTTPServerException, Net::HTTPFatalError, TwitterAuth::Dispatcher::Error => e + rescue Net::HTTPServerException => e case e.message when '401 "Unauthorized"' authentication_failed('This authentication request is no longer valid. Please try again.') and return else authentication_failed('There was a problem trying to authenticate you. Please try again.') and return