Ruby On Rails: Session Handling
Learn how to store user data in your session and clean it up upon logout. We recommend you to Log in to follow this quickstart with examples configured for your account.
I want to explore a sample app2 minutes
Get a sample configured with your account settings or check it out on Github.
Store Session Data on Login
Upon successful authentication, OmniAuth sets the authentication hash of a request to
/auth/oauth2/callback. To handle this request, add a new route in your routes file.
Store the user information in the session in
Clear Session on Logout
Use the following command to create the controller that will handle user logout:
To clear out all the objects stored within the session, call the
reset_session method within the
logout_controller/logout method. Learn more about
logout_helper.rb file add the methods to generate the logout URL.