Does devise have call backs when a user signs in and out?
Warden::Manager.after_authentication do |user,auth,opts| user.update_attribute(:currently_signed_in, true) end Warden::Manager.before_logout do |user,auth,opts| user.update_attribute(:currently_signed_in, false) end
This is what I came with to track users that are currently signed in.
I'm no expert but I believe the callbacks (hooks) are at the Warden level (Devise is built on top of Warden).
after_set_user and before_logout in Warden should do the trick for you but there are other options listed in Warden::Hooks
You can overwrite sign_in in your application controller like this
def sign_in(*args) super(*args) # do whatever you want here token = current_user.authentications.where(provider: "facebook").first.token facebook = Koala::Facebook::API.new(token) session[:facebook] = facebook end
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