-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User remains logged in when using devise and devise_token_auth in the same app #486
Comments
After experimenting with the last workound idea, I think I found part of the cause for the behavior I am seeing. When the mobile app calls DELETE /api/v2/auth/sign_out it does not appear to pass the session cookie in the request headers. That would certainly explain why none of my code changes in the |
Alright, I may have located the source of my problem. Looking at It prescribes the use of Would it be helpful if I attached a pull request with a doc update to that effect? |
Astute readers probably predicted the side-effect of my previous change: |
Thanks to a little more searching, I find that this issue was already covered and resolved in Sorry I didn't see it the (n-1)th time. |
I should also add that my testing method (login, logout, check another browser tab) does not work quite as expected with the beta release. The previous user remains logged in until the new user logs in. |
I have read most of the submitted issues regarding the use of devise and devise_token_auth in the same Rails app, but I have not seen anyone describe the behavior that I am experiencing. I am attempting to do what seems pretty conventional (devise for desktop website auth, devise_token_auth for API namespace access), but I get a very unusual behavior on the mobile app. Here's a brief description of what happens:
The mobile app in question is written using ionic, and what I have seen is that devise appears to be establishing a login session for the mobile app user. When the mobile app user signs out (using the devise_token_auth action) the devise login session persists. This appears to override any subsequent logins, so that the user remains "logged in" as the original user. I thought I was pretty well-versed in wrecking sessions, but I have been unable to come up with a course of action that will log the user out.
My routes file is pretty conventional:
The controller overrides are in place to add attributes to the User model.
This seems like something that would happen in nearly every case where devise and devise_token_auth are used together, so I feel like I must be doing something wrong.
Solutions and workarounds
Has anyone else observed this behavior? If so, how did you work around it?
The text was updated successfully, but these errors were encountered: