[core] log out is not working #7
Labels
No Label
🛃 types
👪 users
invalid
wontfix
🚀 announcement
🎒 backend
🐞 bug
🐋 docker
💡 enhancement
📺 frontend
🤔 question
🔗duplicate
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Flaschengeist/flaschengeist#7
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
session is not deleted on log out.
To reproduce
--> 2 sessions are shown
--> 2 sessions are shown
I think this should be fixed in frontend.
The call stores/index.ts->logout() 'api.delete('/auth/${token}')' should be done within a valid session. Otherwise everybody could delete sessions without beeing logged in.
So the sequence should be changed from:
to
fixed with commit: f2b7f3a3b4
I do not see how the changes should fix the problem.
This is true, but should be checked on the backend not the frontend (check if valid session token is set and session belongs to user).
This was intentional, because if the session is expired the backend will emit a
HTTP-401
on every API request, the frontend will handle this by logging out and go back to login page.Now the logout will try to send a
DELETE
but gets aHTTP-401
which is intercepted and result in an other logout attempt, which leads to infinit logout requests.So the idea was to first patch the session, as the token is "valid" when the function gets called" and then do the logout, because then every next logout attempt will get canceled (guard in line 77 )
But I think this might be not the ideal way of handling this, when we receive a 401 the token is outdated, so we rather should simply clear the stores and LocalStorage.
I see:
store.logout
does not only logout a valid session but does also handles an unauthorized session (HTTP-401
), i.e. an expired session.So solution would be to separate the 2 cases:
store.logout
-- which logs out in backendstore.handleLoggedOut
-- which cleans up to store to be in sync with backendWith this it is possible to have multiple (async) logouts. But these would just result in correctly cleaning up the store.
fixed with comit: 9940589d1a and 625ac55b0a