I am able to login and logout most of the time, but sometimes during logging out I am returned with this error as stated below and I am not logged out.
Can't verify CSRF token authenticity.
User excluded error: #<ActionController::InvalidAuthenticityToken: ActionController::InvalidAuthenticityToken>
It doesn't happen always that I am not able to logout but when I am not able to logout above is the error which I get. I read about it this is what I have done so far. I am using vuejs on my front end and rails on the backend. I am using rails version 5.1.
application_controller.rb
protect_from_forgery with: :exception
application.html.erb
<%= csrf_meta_tags %>
this is the axios request I am making to logout the user
index.vue
logout() {
this.$axios.delete('/users/sign_out').then(function(response) {
console.log("Logged out")
});
}
Please help me resolve this issue