Unofficial OmniAuth strategy for Clever SSO OAuth2 integration.
Add the gem to your application's Gemfile:
gem 'omniauth-clever', '~> 1.0.0'
And then execute:
$ bundle
OmniAuth Clever is Rack Middleware in the OmniAuth convention. See the OmniAuth 1.0 docs for more information.
Follow the Clever OAuth docs to register your application, set callback URLs, and get a client ID and client secret.
Example: In config/initializers/omniauth.rb
, do:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :clever, ENV['CLEVER_CLIENT_ID'], ENV['CLEVER_CLIENT_SECRET']
end
To be able to set the optional clever_landing
or dev
parameters on a
per-request basis by passing these params to your /auth/clever
url, use
this in the initializer instead:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :clever, ENV['CLEVER_CLIENT_ID'], ENV['CLEVER_CLIENT_SECRET'],
:setup => lambda { |env|
params = Rack::Utils.parse_query(env['QUERY_STRING'])
env['omniauth.strategy'].options[:client_options][:clever_landing] = params['clever_landing']
env['omniauth.strategy'].options[:client_options][:dev] = params['dev']
}
end
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
MIT. See LICENSE.txt.
Thank you to the Clever team for their awesome product and always being helpful with any issues. Thank you to Think Through Math for dedicating time for the tech team to make open source contributions such as this.
And, of course. thank you to Omniauth for making it so easy create this gem!