if? devise logout response 401 #8
rpinoon
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
encountered this issue where sending the delete/logout request returns a 401 error 'active-session not found'

issue lies with the code logic on sessions_controller.rb
*delete/logout request invokes 'delete' method in devise and removes user session
*delete method triggers respond_to_destroy method inside sessions_controller while still looking for current_user => which at this point has already been logged-out.
*workaround provided by sir Ed

from https://github.com/heartcombo/devise/blob/main/app/controllers/devise/sessions_controller.rb
pero personally, just took out the if block
or
either works fine 👌
Beta Was this translation helpful? Give feedback.
All reactions