lib/omniauth/strategies/oauth.rb in oa-oauth-0.2.0.beta1 vs lib/omniauth/strategies/oauth.rb in oa-oauth-0.2.0.beta2

- old
+ new

@@ -20,11 +20,11 @@ attr_reader :name attr_accessor :consumer_key, :consumer_secret, :consumer_options def request_phase request_token = consumer.get_request_token(:oauth_callback => callback_url) - (session[:oauth]||={})[name.to_sym] = {:callback_confirmed => request_token.callback_confirmed?, :request_token => request_token.token, :request_secret => request_token.secret} + (session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret} r = Rack::Response.new if request_token.callback_confirmed? r.redirect(request_token.authorize_url) else @@ -33,13 +33,18 @@ r.finish end def callback_phase - request_token = ::OAuth::RequestToken.new(consumer, session[:oauth][name.to_sym].delete(:request_token), session[:oauth][name.to_sym].delete(:request_secret)) + request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret')) opts = {} - opts[:oauth_callback] = callback_url if session[:oauth][:callback_confirmed] + if session['oauth'][name.to_s]['callback_confirmed'] + opts[:oauth_verifier] = request['oauth_verifier'] + else + opts[:oauth_callback] = callback_url + end + @access_token = request_token.get_access_token(opts) super rescue ::OAuth::Unauthorized => e fail!(:invalid_credentials, e) end