Unofficial OmniAuth strategy for Clever SSO OAuth2 integration.
Add the gem to your application's Gemfile:
gem 'omniauth-clever', '~> 1.2.1'
And then execute:
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
Clever is a unique OAuth 2.0 service provider in that login sequences are often initiated by Clever, not the client. When Clever initiates login, a state parameter is not relevant nor sent.
To be able to set the optional district_id
parameter on a per-request basis, passing this 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][:district_id] = params['district_id'] } end
This strategy can be and has been tested with the omniauth-test-harness.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)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. Thank you to StudyPad for helping bringing the strategy up to date.
And, of course. thank you to Omniauth for making it so easy create this gem!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4