OmniAuth
suggest changePick a strategy and add it to the Gemfile. The strategy list is in the OmniAuth wiki.
gem "omniauth-github"
gem "omniauth-openid"
OmniAuth 2 starts authentication only on POST, and a Rails app needs request forgery protection on that route (omniauth-rails_csrf_protection, or the OmniAuth 2 middleware options). A GET link to /auth/:provider will fail on OmniAuth 2.
Register the strategies as middleware:
Rails.application.config.middleware.use OmniAuth::Builder do
require "openid/store/filesystem"
provider :github, ENV["GITHUB_KEY"], ENV["GITHUB_SECRET"]
provider :openid, store: OpenID::Store::Filesystem.new("/tmp")
end
By default, OmniAuth adds /auth/:provider. Start the flow from those paths.
On failure, OmniAuth redirects to /auth/failure.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents