This is actually a pretty simple question but I can’t seem to find the answer. In the Omniauth Overview on Github, there is actually an explanation but I don’t get it:
We pass the :event => :authentication to the sign_in_and_redirect method
to force all authentication callbacks to be called.
I already have authentication working using an action similar to this one:
def facebook
authenticator = UserAuthenticator.new(request.env["omniauth.auth"], current_user)
if authenticator.user_authenticated?
sign_in_and_redirect authenticator.user, :event => :authentication
else
session["devise.oauth_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
All I really want to know is what good is :event => :authentication for?
I just would like to help to figure out the answer. I tracked the source code myself, that help me understand how the
:event => :authenticationparameter works. I hope it also helps you.So your question is why
then, we can track the definition.
and then sign_in define in devise:
Okay, so
:event => :authenticationnow is passed towarden#set_user, Then your question become whyopts[:event] can be
[:set_user, :fetch, :authentication]so,