Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Compatibility with omniauth-oauth2 >= 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
narikazu committed Oct 16, 2020
1 parent 1bde683 commit 2c5947a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/omniauth/strategies/greenhouse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class Greenhouse < OmniAuth::Strategies::OAuth2
def raw_info
@raw_info ||= access_token.get('/v1/partner/current_user').parsed
end

# Override callback URL for compatibility with omniauth-oauth2 >= 1.4,
# which by default passes the entire URL of the callback, including
# query parameters. Greenhouse fails validation because that doesn't match the
# registered callback as required in the Oauth 2.0 spec.
# Refs:
# https://tools.ietf.org/html/rfc6749#section-4.1.3
# https://github.com/omniauth/omniauth-oauth2/commit/26152673224aca5c3e918bcc83075dbb0659717f
# https://github.com/omniauth/omniauth-oauth2/pull/70
def callback_url
options[:redirect_uri] || (full_host + script_name + callback_path)
end
end
end
end

0 comments on commit 2c5947a

Please sign in to comment.