I’m using a single access token and I want to reset it upon signing out.
A possible way would be to call reset_authentication_token! in after_token_authentication in the model, but then I’ll have to know that it’s a sign_out action in the model.
How can I achieve that in a better way?
I’m using devise 1.3.4
Thanks.
Just override “after_sign_out_path_for” in your application controller and reset your token in there. No need to write your own SessionController (although it is very simple as Nathan mentioned).
Here’s the method you should use: http://rubydoc.info/gems/devise/1.3.4/frames
– (Object) after_sign_out_path_for(resource_or_scope)
Method used by sessions controller to sign out a user. You can overwrite it in your ApplicationController to provide a custom hook for a custom scope. Notice that differently from after_sign_in_path_for this method receives a symbol with the scope, and not the resource.
By default is the root_path.
cheers