Skip to content

Add option for full_host to allow Clever login from non-secure pages #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/omniauth/strategies/clever.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class Clever < OmniAuth::Strategies::OAuth2
# **State will still be verified** when login is initiated by the client.
option :provider_ignores_state, true

option :full_host

# Allows full host to be overridden. This is important because Clever is forcing https in production,
# so we need to use https redirect url even when our host page is http.
def full_host
if options.full_host.blank?
super
else
options.full_host
end
end

def token_params
super.tap do |params|
params[:headers] = {'Authorization' => "Basic #{Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")}"}
Expand Down