Skip to content

Commit af49c80

Browse files
committed
Merge pull request #10 from carsonreinke/callback_url
Ignore query string for callback url
2 parents a72dae4 + 082962a commit af49c80

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.bundle
22
Gemfile.lock
33
coverage
4-
reports
4+
reports

lib/omniauth/strategies/bigcommerce.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def authorize_params
4848
end
4949
end
5050
end
51+
52+
#Exclude query string in callback
53+
def callback_url
54+
full_host + script_name + callback_path
55+
end
5156
end
5257
end
5358
end

spec/omniauth/strategies/bigcommerce_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@
4545
it 'should have the correct path' do
4646
expect(subject.callback_path).to eq('/auth/bigcommerce/callback')
4747
end
48+
49+
it 'should use no query string for callback url' do
50+
request = double('Request', :params => {}, :cookies => {}, :env => {})
51+
allow(request).to receive(:scheme).and_return('http')
52+
allow(request).to receive(:url).and_return('http://example.com')
53+
54+
allow(subject).to receive(:request).and_return(request)
55+
allow(subject).to receive(:script_name).and_return('')
56+
57+
subject.callback_url
58+
end
4859
end
4960

5061
context 'authorize options' do

0 commit comments

Comments
 (0)