Skip to content

Commit

Permalink
Merge pull request #73 from volmer/master
Browse files Browse the repository at this point in the history
Do not include query params in callback URLs
  • Loading branch information
tmilewski authored May 23, 2017
2 parents a893c2b + d8d5c21 commit 1888397
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/omniauth/strategies/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def email_access_allowed?
scopes = options['scope'].split(',')
(scopes & email_scopes).any?
end

def callback_url
full_host + script_name + callback_path
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions spec/omniauth/strategies/github_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,13 @@
expect(subject.info['urls']['GitHub']).to eq('http://enterprise/me')
end
end

describe '#callback_url' do
it 'is a combination of host, script name, and callback path' do
allow(subject).to receive(:full_host).and_return('https://example.com')
allow(subject).to receive(:script_name).and_return('/sub_uri')

expect(subject.callback_url).to eq('https://example.com/sub_uri/auth/github/callback')
end
end
end

0 comments on commit 1888397

Please sign in to comment.