Skip to content
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

Logout view returns 200 status code when no user is logged in #439

Open
edmundsj opened this issue Oct 2, 2022 · 3 comments
Open

Logout view returns 200 status code when no user is logged in #439

edmundsj opened this issue Oct 2, 2022 · 3 comments

Comments

@edmundsj
Copy link

edmundsj commented Oct 2, 2022

I was expecting to receive a 400 status code when submitting a POST request for log-out if there is no user logged in - because we can't log someone out who wasn't logged in in the first place! However, it looks like I am getting back 200 status codes regardless of whether the user in question was previously logged in or logged out. Seems odd.

@smyja
Copy link

smyja commented Oct 16, 2022

have you resolved this?

I was expecting to receive a 400 status code when submitting a POST request for log-out if there is no user logged in - because we can't log someone out who wasn't logged in in the first place! However, it looks like I am getting back 200 status codes regardless of whether the user in question was previously logged in or logged out. Seems odd.

@rochdikhalid
Copy link

rochdikhalid commented Feb 10, 2023

@edmundsj You are right, returning a 200 status code for a logout request if the user is not authenticated is not considered to be the best practice. A 400 status code, or Bad Request, would be more appropriate in this case, as it indicates that the request is malformed or incorrect in some way.

@vadimshvetsov
Copy link

vadimshvetsov commented May 16, 2024

Thats because there are permission_classes = (AllowAny,) on LogoutView. I'm gonna open PR for adding isAuthenticated there to follow code intentions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants