Skip to content

Commit 1888397

Browse files
authored
Merge pull request #73 from volmer/master
Do not include query params in callback URLs
2 parents a893c2b + d8d5c21 commit 1888397

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/omniauth/strategies/github.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def email_access_allowed?
6969
scopes = options['scope'].split(',')
7070
(scopes & email_scopes).any?
7171
end
72+
73+
def callback_url
74+
full_host + script_name + callback_path
75+
end
7276
end
7377
end
7478
end

spec/omniauth/strategies/github_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,13 @@
149149
expect(subject.info['urls']['GitHub']).to eq('http://enterprise/me')
150150
end
151151
end
152+
153+
describe '#callback_url' do
154+
it 'is a combination of host, script name, and callback path' do
155+
allow(subject).to receive(:full_host).and_return('https://example.com')
156+
allow(subject).to receive(:script_name).and_return('/sub_uri')
157+
158+
expect(subject.callback_url).to eq('https://example.com/sub_uri/auth/github/callback')
159+
end
160+
end
152161
end

0 commit comments

Comments
 (0)