Using Rails 6.0.3.6, ruby 2.7.2p137 and devise (4.7.3).
When user call a logout it works well, if its a normal scenario. But the same logout gives error in the conditions:
If user has opened 2 tabs and logout from 1st tab and tries to logout from the 2nd tab it gives error.
If user logout and click the browser back button and then again click the logout button then it again result in an error.
Please suggest an process to be coded in the project by which the user get redirected to the home path stating user is already signed out instead of giving the error.
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 5ms (ActiveRecord: 0.5ms | Allocations: 3332)
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
Note: <%= csrf_meta_tags %> tag is already present in the layout of application.
Having a
before_action :authenticate_user!in yourapplication_controller.rbshould solve the issue.