Skip to content

Commit 4a537cc

Browse files
nickcampbell18Nick Campbell
authored andcommitted
Upgrade to omniauth-oauth2 1.4.0 and fix callback url issue
Omniauth defines callback URL as: full_host + script_name + callback_path + query_string (via https://github.com/intridea/omniauth/blob/1cc1cf4b2821a7d2a4a376a5ca93c61b6bd8b5f1/lib/omniauth/strategy.rb#L432) Omniauth-oauth2 declines to override this after omniauth/omniauth-oauth2#70 So, this library is overriding omniauth itself, and omitting the query string from the callback_url (which Azure AD seems to have trouble with).
1 parent 78b39f5 commit 4a537cc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/omniauth/strategies/azure_oauth2.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def client
2525

2626
options.client_id = provider.client_id
2727
options.client_secret = provider.client_secret
28-
options.tenant_id =
28+
options.tenant_id =
2929
provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common'
3030

3131
options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint
@@ -53,6 +53,9 @@ def client
5353
}
5454
end
5555

56+
def callback_url
57+
full_host + script_name + callback_path
58+
end
5659

5760
def raw_info
5861
# it's all here in JWT http://msdn.microsoft.com/en-us/library/azure/dn195587.aspx

omniauth-azure-oauth2.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
1919
gem.add_dependency 'omniauth', '~> 1.0'
2020
gem.add_dependency 'jwt', '~> 1.0'
2121

22-
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.1'
22+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.4'
2323

2424
gem.add_development_dependency 'rspec', '>= 2.14.0'
2525
gem.add_development_dependency 'rake'

0 commit comments

Comments
 (0)