Sorcery/sorcery

[question] How to logout all users

JoaoPedroAssis opened this issue · 3 comments

Hey guys!

I have an app which uses the session storage to save some data and make things a little faster. But when I was updating the code, I found out that I needed those sessions to be updated and the code was not fit to do that. This particular session info happens to break the code, so I fixed everything. The real issue is that I cant update the session data for all the users, and the best way to do that would be to just logout everyone, so that the new code can be executed properly.

How can I logout all the users? Or better yet, just erase all session info

Configuration

  • Sorcery Version: 0.16.1
  • Ruby Version: 2.7.2
  • Framework: Rails
  • Platform: Linux

Hi @JoaoPedroAssis, sorry for the late reply.

You can use the following command to clear out all sessions: rails db:sessions:clear

This would remove all session data from the application, irreversibly (be sure before you run it on production, consider running your database backup beforehand). As this is a destructive command, do some secondary research to make sure this is what you want before running it.

Let me know if this answers your question!

Thanks for the reply! I did some digging and found that just by changing the secret key base value, all sessions would be labeled as invalid, logging off all users

Looking at your suggestion, I think this method would work as well, thanks!

Glad to help! Feel free to reopen or create a new issue if anything else comes up.