is it possible using OmniAuth to require login before certain actions?
I remember from a railscast that Devise has a before_filter, but does OmniAuth?
You can add a before_filter
:
class ApplicationController < ActionController::Base
before_filter :authenticate
def authenticate
redirect_to :login unless User.find_by_provider_and_uid(auth["provider"], auth["uid"])
end
...
end
Presuming:
1. You have defined a login page with link(s) like : <%= link_to "Sign in with Facebook", "/auth/facebook" %>
See also RailsCasts tagged with authentication
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With