Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I sign out a devise user from the Rails console?

My devise users are "database_authenticatable" and "token_authenticatable". I've tried deleting the "authentication_token" field in the database for that user from the console, but they still seem to be able to use their existing auth token. Deleting the user entirely works, but I don't want to go that far.

Edit: for clarity. I want to use the rails console to sign out a user. i.e. run rails console and then some command.

like image 268
joseph.hainline Avatar asked Mar 09 '15 04:03

joseph.hainline


1 Answers

Devise provides helper methods to do these things:

user = User.find(params[:id])
sign_in user
sign_out user

Hope this helps.

like image 118
Ankit Samarthya Avatar answered Oct 22 '22 00:10

Ankit Samarthya