Skip to content

Commit 597ac9e

Browse files
authored
Merge pull request #12 from teamsimplepay/master
support additional authorization options at runtime
2 parents 6daa22a + bfd3473 commit 597ac9e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/omniauth/strategies/xero_oauth2.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module Strategies
66
class XeroOauth2 < OmniAuth::Strategies::OAuth2
77
option :name, :xero_oauth2
88

9+
option :authorize_options, %i[login_hint state redirect_uri scope]
10+
911
option(
1012
:client_options,
1113
{
@@ -15,6 +17,14 @@ class XeroOauth2 < OmniAuth::Strategies::OAuth2
1517
},
1618
)
1719

20+
def authorize_params
21+
super.tap do |params|
22+
options[:authorize_options].each do |k|
23+
params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
24+
end
25+
end
26+
end
27+
1828
def callback_url
1929
options[:redirect_uri] || (full_host + callback_path)
2030
end

omniauth-xero-oauth2.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
1212
s.metadata = { 'source_code_uri' => 'https://github.com/XeroAPI/xero-oauth2-omniauth-strategy' }
1313
s.files = ['lib/omniauth-xero-oauth2.rb','lib/xero-oauth2/version.rb','lib/omniauth/strategies/xero_oauth2.rb']
1414

15-
s.add_dependency 'omniauth', '~> 2.0.0'
15+
s.add_dependency 'omniauth', '>= 2.0.0', '< 2.2.0'
1616
s.add_dependency 'omniauth-oauth2', '~> 1.7.1'
1717

1818
s.add_development_dependency 'rspec', '~> 3.6'

0 commit comments

Comments
 (0)