diff --git a/lib/omniauth/strategies/twitter.rb b/lib/omniauth/strategies/twitter.rb index 3d890b61..26ada821 100644 --- a/lib/omniauth/strategies/twitter.rb +++ b/lib/omniauth/strategies/twitter.rb @@ -61,8 +61,14 @@ def request_phase old_request_phase end + alias :old_callback_url :callback_url + def callback_url - request.params['callback_url'] + if request.params['callback_url'] + request.params['callback_url'] + else + old_callback_url + end end def callback_path diff --git a/spec/omniauth/strategies/twitter_spec.rb b/spec/omniauth/strategies/twitter_spec.rb index 08d726f7..7b1f8f57 100644 --- a/spec/omniauth/strategies/twitter_spec.rb +++ b/spec/omniauth/strategies/twitter_spec.rb @@ -160,10 +160,11 @@ double('Session', :[] => {}) end allow(subject).to receive(:old_request_phase) { :whatever } + allow(subject).to receive(:old_callback_url).and_return(:old_callback) end it 'callback_url should return nil' do - expect(subject.callback_url).to be_nil + expect(subject.callback_url).to eq :old_callback end it 'should return the default callback_path value' do