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

- old
+ new

@@ -1,5 +1,6 @@ +require 'multi_json' require 'oauth' require 'omniauth/oauth' module OmniAuth module Strategies @@ -11,10 +12,11 @@ self.consumer_secret = consumer_secret self.consumer_options = consumer_options super self.options[:open_timeout] ||= 30 self.options[:read_timeout] ||= 30 + self.options[:authorize_params] = options[:authorize_params] || {} end def consumer consumer = ::OAuth::Consumer.new(consumer_key, consumer_secret, consumer_options.merge(options[:client_options] || options[:consumer_options] || {})) consumer.http.open_timeout = options[:open_timeout] if options[:open_timeout] @@ -30,12 +32,12 @@ session['oauth'] ||= {} 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) + r.redirect(request_token.authorize_url(options[:authorize_params])) else - r.redirect(request_token.authorize_url(:oauth_callback => callback_url)) + r.redirect(request_token.authorize_url(options[:authorize_params].merge(:oauth_callback => callback_url))) end r.finish rescue ::Timeout::Error => e fail!(:timeout, e)