baschtl/devise-token_authenticatable

Logout the current user when authenticating using token

Closed this issue · 5 comments

Hi,

Thank you for keeping this up. I need some help though. Do you have any suggestions on how to logout the current user when I am clicking the auth_token link?

Thanks.

Could you elaborate on this a bit more? What do you mean by auth_token link?

I mean when I am visiting the link with the ?auth_token=xxxxxx in it, is there a way to log out the current user and log in the user identified by auth_token. As of now I have to open the incognito window or log out manually.

Take a look at https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/sign_in_out.rb#L56. I guess you want to log out the user within the controller of your application, am I right?

I want to make sure every time the user clicks the link with the token he is logged in to that account even if he was previously logged in under a different account. From application point of view it doesn't know and doesn't care how exactly users login.

Well, my best guess is written in my previous comment. I hope that helps. Otherwise you should take a look at the devise documentation.