Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Commit

Permalink
Fix compatibility with omniauth-oauth 1.4+ and allow http locally (#4)
Browse files Browse the repository at this point in the history
* Fix compatibility with omniauth-oauth 1.4+

References:
* omniauth/omniauth-oauth2#70
* omniauth/omniauth-oauth2@2615267
* omniauth/omniauth-oauth2#82
* jdennes/omniauth-createsend#3
* WebTheoryLLC/omniauth-twitch#4
* jdennes/omniauth-createsend#5
* DripEmail/omniauth-drip#6

* Don't force https if it's localhost

* Allow 127.0.0.1 and localhost to be on http

* Lookup IP for the given host and force ssl

Avoid to force ssl for local IPs (127/8 network)

* Improve resolving

* Improve even more

* Fix regexp

* Allow fe80::* entirely
  • Loading branch information
webgago authored and l1h3r committed Mar 16, 2018
1 parent d282c51 commit d4be6d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/omniauth/strategies/infusionsoft.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'omniauth-oauth2'
require 'resolv'

module OmniAuth
module Strategies
Expand All @@ -22,11 +23,15 @@ def full_host
uri.path = ''
uri.query = nil
#infusionsoft requires https for callback urls
uri.scheme = 'https'
#force ssl for all hosts except: 127.x.x.x, fe80:: and ::1
uri.scheme = 'https' unless Resolv.getaddress(uri.host) =~ /^(fe80::|127|::1)/
uri.to_s
end
end

def callback_url
full_host + script_name + callback_path
end
end
end
end

0 comments on commit d4be6d0

Please sign in to comment.